Skip to content

Commit 6243817

Browse files
committed
styling, pausing from dialogs, and snackbar demo
1 parent 26aeed8 commit 6243817

19 files changed

+602
-336
lines changed

MainDemo.Wpf/App.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Application x:Class="MaterialDesignColors.WpfExample.App"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
StartupUri="ProvingGround.xaml">
4+
StartupUri="MainWindow.xaml">
55
<Application.Resources>
66
<ResourceDictionary>
77
<ResourceDictionary.MergedDictionaries>

MainDemo.Wpf/MainWindow.xaml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
</ResourceDictionary>
3636
</Window.Resources>
3737

38-
<materialDesign:DialogHost Identifier="RootDialog">
38+
<materialDesign:DialogHost Identifier="RootDialog" SnackbarMessageQueue="{Binding ElementName=MainSnackbar, Path=MessageQueue}">
3939
<materialDesign:DrawerHost IsLeftDrawerOpen="{Binding ElementName=MenuToggleButton, Path=IsChecked}">
4040
<materialDesign:DrawerHost.LeftDrawerContent>
4141
<DockPanel MinWidth="212">
@@ -88,11 +88,6 @@
8888
<wpfExample:Sliders />
8989
</domain:DemoItem.Content>
9090
</domain:DemoItem>
91-
<domain:DemoItem Name="Snackbar">
92-
<domain:DemoItem.Content>
93-
<wpfExample:Snackbar />
94-
</domain:DemoItem.Content>
95-
</domain:DemoItem>
9691
<domain:DemoItem Name="Chips">
9792
<domain:DemoItem.Content>
9893
<wpfExample:Chips />
@@ -183,6 +178,11 @@
183178
<materialDesignDemo:Drawers />
184179
</domain:DemoItem.Content>
185180
</domain:DemoItem>
181+
<domain:DemoItem Name="Snackbar">
182+
<domain:DemoItem.Content>
183+
<materialDesignDemo:Snackbars />
184+
</domain:DemoItem.Content>
185+
</domain:DemoItem>
186186
<domain:DemoItem Name="Transitions">
187187
<domain:DemoItem.Content>
188188
<materialDesignDemo:Transitions />
@@ -214,7 +214,10 @@
214214
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22">Material Design In XAML Toolkit</TextBlock>
215215
</DockPanel>
216216
</materialDesign:ColorZone>
217-
<ContentControl Margin="16" Content="{Binding ElementName=DemoItemsListBox, Path=SelectedItem.Content}" />
217+
<Grid>
218+
<ContentControl Margin="16" Content="{Binding ElementName=DemoItemsListBox, Path=SelectedItem.Content}" />
219+
<materialDesign:Snackbar MessageQueue="{materialDesign:MessageQueue}" x:Name="MainSnackbar" />
220+
</Grid>
218221
</DockPanel>
219222
</materialDesign:DrawerHost>
220223
</materialDesign:DialogHost>

MainDemo.Wpf/MainWindow.xaml.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using System.Windows;
1+
using System.Threading;
2+
using System.Threading.Tasks;
3+
using System.Windows;
24
using System.Windows.Controls;
35
using System.Windows.Controls.Primitives;
46
using System.Windows.Input;
@@ -15,9 +17,21 @@ public partial class MainWindow : Window
1517
{
1618
public MainWindow()
1719
{
18-
InitializeComponent();
20+
InitializeComponent();
21+
22+
Task.Factory.StartNew(() =>
23+
{
24+
Thread.Sleep(2500);
25+
}).ContinueWith(t =>
26+
{
27+
//note you can use the message queue from any thread, but just for the demo here we
28+
//need to get the message queue from the snackbar, so need to be on the dispatcher
29+
MainSnackbar.MessageQueue.Enqueue("Welcome to Material Design In XAML Tookit");
30+
}, TaskScheduler.FromCurrentSynchronizationContext());
1931
}
2032

33+
34+
2135
private void UIElement_OnPreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
2236
{
2337
//until we had a StaysOpen glag to Drawer, this will help with scroll bars

MainDemo.Wpf/MaterialDesignDemo.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@
157157
<Compile Include="Sliders.xaml.cs">
158158
<DependentUpon>Sliders.xaml</DependentUpon>
159159
</Compile>
160-
<Compile Include="Snackbar.xaml.cs">
161-
<DependentUpon>Snackbar.xaml</DependentUpon>
160+
<Compile Include="Snackbars.xaml.cs">
161+
<DependentUpon>Snackbars.xaml</DependentUpon>
162162
</Compile>
163163
<Compile Include="TextFields.xaml.cs">
164164
<DependentUpon>TextFields.xaml</DependentUpon>
@@ -308,7 +308,7 @@
308308
<SubType>Designer</SubType>
309309
<Generator>MSBuild:Compile</Generator>
310310
</Page>
311-
<Page Include="Snackbar.xaml">
311+
<Page Include="Snackbars.xaml">
312312
<SubType>Designer</SubType>
313313
<Generator>MSBuild:Compile</Generator>
314314
</Page>

0 commit comments

Comments
 (0)