|
5 | 5 | xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
6 | 6 | xmlns:local="clr-namespace:MaterialDesignDemo"
|
7 | 7 | xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
| 8 | + xmlns:codeDisplayer="clr-namespace:CodeDisplayer;assembly=CodeDisplayer" |
8 | 9 | mc:Ignorable="d"
|
9 | 10 | d:DesignHeight="300" d:DesignWidth="300">
|
10 | 11 |
|
11 | 12 | <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Hidden">
|
12 |
| - <Grid Margin="0 0 0 4"> |
13 |
| - <Grid.ColumnDefinitions> |
14 |
| - <ColumnDefinition Width="340" /> |
15 |
| - <ColumnDefinition Width="340" /> |
16 |
| - <ColumnDefinition Width="340" /> |
17 |
| - <ColumnDefinition Width="340" /> |
18 |
| - </Grid.ColumnDefinitions> |
19 |
| - <Grid.RowDefinitions> |
20 |
| - <RowDefinition /> |
21 |
| - <RowDefinition /> |
22 |
| - </Grid.RowDefinitions> |
23 |
| - |
24 |
| - <!-- example 1 --> |
| 13 | + <codeDisplayer:XamlDisplayerPanel x:Name="XamlDisplayerPanel" Margin="0 0 0 4"> |
25 | 14 | <Border Background="{DynamicResource MaterialDesignSelection}"
|
26 | 15 | Padding="8 0 8 0">
|
27 |
| - <Grid> |
| 16 | + <Grid Height="200"> |
28 | 17 | <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
29 | 18 | <TextBlock TextWrapping="WrapWithOverflow" Style="{DynamicResource MaterialDesignSubheadingTextBlock}">Example 1.</TextBlock>
|
30 | 19 | <TextBlock TextWrapping="WrapWithOverflow" >Simple definition within XAML. Use the toggle to display the message.</TextBlock>
|
31 |
| - <ToggleButton IsChecked="{Binding ElementName=SnackbarOne, Path=IsActive, Mode=TwoWay}" |
| 20 | + <ToggleButton x:Name="ToggleButton1" |
32 | 21 | Margin="0 8 0 0"/>
|
33 | 22 | </StackPanel>
|
34 |
| - |
35 |
| - |
36 | 23 | <!-- simplest form -->
|
37 | 24 | <materialDesign:Snackbar Message="hello 1"
|
38 |
| - IsActive="False" |
39 |
| - x:Name="SnackbarOne" /> |
| 25 | + IsActive="{Binding ElementName=ToggleButton1, Path=IsChecked}" |
| 26 | + Width="300"/> |
40 | 27 | </Grid>
|
41 | 28 | </Border>
|
42 | 29 |
|
43 |
| - <!-- example 2 --> |
44 |
| - <Border Background="{DynamicResource MaterialDesignPaper}" |
45 |
| - Padding="8 0 8 0" |
46 |
| - Grid.Column="1"> |
| 30 | + <Border Background="{DynamicResource MaterialDesignPaper}" Height="200" |
| 31 | + Padding="8 0 8 0"> |
47 | 32 | <Grid>
|
48 | 33 | <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
49 | 34 | <TextBlock TextWrapping="WrapWithOverflow" Style="{DynamicResource MaterialDesignSubheadingTextBlock}">Example 2.</TextBlock>
|
50 | 35 | <TextBlock TextWrapping="WrapWithOverflow" >View source to see message defined in long hand, allowing action button content to be set.</TextBlock>
|
51 |
| - <ToggleButton IsChecked="{Binding ElementName=SnackbarTwo, Path=IsActive, Mode=TwoWay}" |
| 36 | + <ToggleButton x:Name="ToggleButton2" |
52 | 37 | Margin="0 8 0 0" />
|
53 | 38 | </StackPanel>
|
54 |
| - |
55 | 39 | <!-- long hand form for setting the message -->
|
56 |
| - <materialDesign:Snackbar IsActive="False" |
57 |
| - x:Name="SnackbarTwo" > |
| 40 | + <materialDesign:Snackbar IsActive="{Binding ElementName=ToggleButton2, Path=IsChecked}"> |
58 | 41 | <materialDesign:SnackbarMessage Content="Hello 2" ActionContent="UNDO" />
|
59 | 42 | </materialDesign:Snackbar>
|
60 | 43 | </Grid>
|
61 | 44 | </Border>
|
62 | 45 |
|
63 |
| - <!-- example 3 --> |
64 |
| - <!-- |
| 46 | + <Border Background="{DynamicResource MaterialDesignSelection}" |
| 47 | + Padding="8 0 8 0"> |
| 48 | + <!-- |
65 | 49 | * using a message queue to manage queuing of messages, and getting onto correct thread
|
66 | 50 | * notice the shorthand syntax {materialDesign:MessageQueue} for creating a new message
|
67 | 51 | queue without expanded XAML. useful in code-behind scenarios if you dont want to bind
|
68 | 52 | a message queue in to the snackbar.
|
69 | 53 | -->
|
70 |
| - <Border Background="{DynamicResource MaterialDesignSelection}" |
71 |
| - Padding="8 0 8 0" |
72 |
| - Grid.Column="2"> |
73 | 54 | <Grid>
|
74 | 55 | <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
75 | 56 | <TextBlock TextWrapping="WrapWithOverflow" Style="{DynamicResource MaterialDesignSubheadingTextBlock}">Example 3.</TextBlock>
|
76 |
| - <TextBlock TextWrapping="WrapWithOverflow">In many real world scenario, notification display must deal with threading, queuing, and potentially heavy usage. A MessageQueue can be set to handle much of this for you, gicing the following benefits:</TextBlock> |
| 57 | + <TextBlock TextWrapping="WrapWithOverflow" MaxWidth="300">In many real world scenario, notification display must deal with threading, queuing, and potentially heavy usage. A MessageQueue can be set to handle much of this for you, gicing the following benefits:</TextBlock> |
77 | 58 | <TextBlock TextWrapping="WrapWithOverflow" Margin="0 8 0 0" Text=" • Messages can be queued from any thread"/>
|
78 | 59 | <TextBlock TextWrapping="WrapWithOverflow" Text=" • Message will auto hide after a time out period"/>
|
79 | 60 | <TextBlock TextWrapping="WrapWithOverflow" Text=" • Notification will not time out if mouse is over it"/>
|
|
99 | 80 | </Grid>
|
100 | 81 | </Border>
|
101 | 82 |
|
102 |
| - <!-- example 4 --> |
103 |
| - <!-- illustrates queueing uses some action command call backs --> |
104 | 83 | <Border Background="{DynamicResource MaterialDesignPaper}"
|
105 |
| - Padding="8 0 8 0" |
106 |
| - Grid.Column="3"> |
| 84 | + Padding="8 0 8 0"> |
| 85 | + <!-- illustrates queueing uses some action command call backs --> |
107 | 86 | <Grid>
|
108 | 87 | <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
109 | 88 | <TextBlock TextWrapping="WrapWithOverflow" Style="{DynamicResource MaterialDesignSubheadingTextBlock}">Example 4.</TextBlock>
|
110 |
| - <TextBlock TextWrapping="WrapWithOverflow">Illustrates queueing (including discarding of duplicates), and handling of commands. Action a notification to see a System.Trace response..</TextBlock> |
| 89 | + <TextBlock TextWrapping="WrapWithOverflow" MaxWidth="300">Illustrates queueing (including discarding of duplicates), and handling of commands. Action a notification to see a System.Trace response..</TextBlock> |
111 | 90 | <Grid Margin="0 16 0 0">
|
112 | 91 | <Grid.ColumnDefinitions>
|
113 | 92 | <ColumnDefinition Width="*" />
|
|
123 | 102 | </Grid>
|
124 | 103 | </Border>
|
125 | 104 |
|
126 |
| - <!-- example 5 --> |
| 105 | + <Border Background="{DynamicResource MaterialDesignChipBackground}" Height="300"> |
127 | 106 | <!-- full width snack bar -->
|
128 |
| - <Border Background="{DynamicResource MaterialDesignChipBackground}" |
129 |
| - Grid.ColumnSpan="2" |
130 |
| - Grid.Row="1"> |
131 | 107 | <StackPanel VerticalAlignment="Bottom">
|
132 | 108 | <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"
|
133 | 109 | Margin="0 0 0 32">
|
134 | 110 | <TextBlock TextWrapping="WrapWithOverflow" Style="{DynamicResource MaterialDesignSubheadingTextBlock}">Example 5.</TextBlock>
|
135 | 111 | <TextBlock TextWrapping="WrapWithOverflow">Illustrates a full width Snackbar.</TextBlock>
|
136 |
| - <ToggleButton IsChecked="{Binding ElementName=SnackbarFive, Path=IsActive, Mode=TwoWay}" |
| 112 | + <ToggleButton x:Name="ToggleButton3" |
137 | 113 | Margin="0 8 0 0" />
|
138 | 114 | </StackPanel>
|
139 |
| - <materialDesign:Snackbar HorizontalAlignment="Stretch" |
140 |
| - x:Name="SnackbarFive"> |
| 115 | + <materialDesign:Snackbar HorizontalAlignment="Stretch" IsActive="{Binding ElementName=ToggleButton3, Path=IsChecked}"> |
141 | 116 | <materialDesign:SnackbarMessage Content="This Snackbar is stretched horizontally. Consider allowing your content to push up."
|
142 | 117 | ActionContent="OK" />
|
143 | 118 | </materialDesign:Snackbar>
|
144 | 119 | </StackPanel>
|
145 | 120 | </Border>
|
146 | 121 |
|
147 |
| - <!-- example 6 --> |
| 122 | + <Border> |
148 | 123 | <!-- colour variations -->
|
149 |
| - <Border Grid.Column="2" Grid.Row="1"> |
150 | 124 | <Border.Resources>
|
151 | 125 | <ResourceDictionary>
|
152 | 126 | <ResourceDictionary.MergedDictionaries>
|
|
182 | 156 | </materialDesign:Snackbar>
|
183 | 157 | </StackPanel>
|
184 | 158 | </Border>
|
185 |
| - </Grid> |
| 159 | + </codeDisplayer:XamlDisplayerPanel> |
186 | 160 | </ScrollViewer>
|
187 | 161 | </UserControl>
|
0 commit comments