|
| 1 | +<UserControl x:Class="MaterialDesignColors.WpfExample.Dialogs" |
| 2 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 3 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 4 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 5 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 6 | + xmlns:local="clr-namespace:MaterialDesignColors.WpfExample" |
| 7 | + xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf" |
| 8 | + xmlns:system="clr-namespace:System;assembly=mscorlib" |
| 9 | + mc:Ignorable="d" |
| 10 | + d:DesignHeight="300" d:DesignWidth="300"> |
| 11 | + <UserControl.Resources> |
| 12 | + <ResourceDictionary> |
| 13 | + <ResourceDictionary.MergedDictionaries> |
| 14 | + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Button.xaml" /> |
| 15 | + </ResourceDictionary.MergedDictionaries> |
| 16 | + </ResourceDictionary> |
| 17 | + </UserControl.Resources> |
| 18 | + <Grid> |
| 19 | + <Grid.RowDefinitions> |
| 20 | + <RowDefinition Height="Auto" /> |
| 21 | + <RowDefinition Height="*" /> |
| 22 | + </Grid.RowDefinitions> |
| 23 | + <StackPanel> |
| 24 | + <TextBlock>WORK IN PROGRESS...DO NOT USE YET...API NOT FINALISED.</TextBlock> |
| 25 | + <!-- |
| 26 | + <TextBlock>Dialogs can be hosted at any level of you visual tree.</TextBlock> |
| 27 | + <TextBlock>When a dialog is open the underlying content will be disabled.</TextBlock> |
| 28 | + --> |
| 29 | + </StackPanel> |
| 30 | + |
| 31 | + <Grid Grid.Row="1"> |
| 32 | + <Grid.RowDefinitions> |
| 33 | + <RowDefinition Height="Auto" /> |
| 34 | + <RowDefinition Height="*" /> |
| 35 | + </Grid.RowDefinitions> |
| 36 | + <Grid.ColumnDefinitions> |
| 37 | + <ColumnDefinition Width="1*" /> |
| 38 | + <ColumnDefinition Width="1*" /> |
| 39 | + </Grid.ColumnDefinitions> |
| 40 | + |
| 41 | + <TextBlock TextWrapping="Wrap" HorizontalAlignment="Center" |
| 42 | + Margin="16">SAMPLE 1: Dialog encapsulating specific content, launched from a routed command, response handled in code-behind.</TextBlock> |
| 43 | + <wpf:DialogHost DialogClosing="DialogHost_OnDialogClosing" |
| 44 | + Grid.Column="0" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center"> |
| 45 | + <wpf:DialogHost.DialogContent> |
| 46 | + <StackPanel Margin="16"> |
| 47 | + <TextBlock>Add a new fruit.</TextBlock> |
| 48 | + <TextBox Margin="0 8 0 0" HorizontalAlignment="Stretch" x:Name="FruitTextBox" /> |
| 49 | + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" > |
| 50 | + <Button Style="{StaticResource MaterialDesignFlatButton}" |
| 51 | + IsDefault="True" |
| 52 | + Margin="0 8 8 0" |
| 53 | + Command="wpf:DialogHost.CloseDialogCommand"> |
| 54 | + <Button.CommandParameter> |
| 55 | + <system:Boolean>True</system:Boolean> |
| 56 | + </Button.CommandParameter> |
| 57 | + ACCEPT |
| 58 | + </Button> |
| 59 | + <Button Style="{StaticResource MaterialDesignFlatButton}" |
| 60 | + IsCancel="True" |
| 61 | + Margin="0 8 8 0" |
| 62 | + Command="wpf:DialogHost.CloseDialogCommand"> |
| 63 | + <Button.CommandParameter> |
| 64 | + <system:Boolean>False</system:Boolean> |
| 65 | + </Button.CommandParameter> |
| 66 | + CANCEL |
| 67 | + </Button> |
| 68 | + </StackPanel> |
| 69 | + </StackPanel> |
| 70 | + </wpf:DialogHost.DialogContent> |
| 71 | + <Border BorderThickness="1" BorderBrush="{DynamicResource PrimaryHueMidBrush}" |
| 72 | + MinWidth="256" MinHeight="256"> |
| 73 | + <Grid> |
| 74 | + <Grid.RowDefinitions> |
| 75 | + <RowDefinition Height="*" /> |
| 76 | + <RowDefinition Height="Auto" /> |
| 77 | + </Grid.RowDefinitions> |
| 78 | + <ListBox x:Name="FruitListBox"> |
| 79 | + <ListBoxItem>Apple</ListBoxItem> |
| 80 | + <ListBoxItem>Banana</ListBoxItem> |
| 81 | + <ListBoxItem>Pear</ListBoxItem> |
| 82 | + </ListBox> |
| 83 | + <wpf:ColorZone Mode="PrimaryMid" Grid.Row="1"> |
| 84 | + <TextBlock Margin="16">Fruit Bowl</TextBlock> |
| 85 | + </wpf:ColorZone> |
| 86 | + <Button Style="{StaticResource MaterialDesignFloatingActionAccentButton}" |
| 87 | + Command="{x:Static wpf:DialogHost.OpenDialogCommand}" |
| 88 | + VerticalAlignment="Bottom" HorizontalAlignment="Right" |
| 89 | + Grid.Row="0" Margin="0 0 28 -20"> |
| 90 | + <Viewbox Width="22" Height="22"> |
| 91 | + <Canvas Width="24" Height="24"> |
| 92 | + <Path Data="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z" Fill="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Button}, Path=Foreground}" /> |
| 93 | + </Canvas> |
| 94 | + </Viewbox> |
| 95 | + </Button> |
| 96 | + </Grid> |
| 97 | + </Border> |
| 98 | + </wpf:DialogHost> |
| 99 | + </Grid> |
| 100 | + </Grid> |
| 101 | +</UserControl> |
0 commit comments