Skip to content

Commit 5ac5e2a

Browse files
authored
Merge pull request #21 from ButchersBoy/master
update from original repo
2 parents d30363d + 2ea22cd commit 5ac5e2a

24 files changed

+1612
-45
lines changed

.github/ISSUE_TEMPLATE

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# PLEASE READ BEFORE POSTING AN ISSUE
2+
13
# This is a place for issues. Questions are better asked in the Gitter chat room.
24

3-
# Seriously consider creating and linking to a test repo which takes absolutely minimal setup to illustrate how reproduce the problem.
5+
# Seriously consider creating and linking to a test repo which takes absolutely minimal setup to illustrate how reproduce the problem. My time is limited and and .Zip files, code snippets and partial examples are often a code snippet. GitHub also provides great communication and code review tools which can be utilised.
6+
7+
# HOW TO POST A GOOD SAMPLE. Follow these guidelines and I will most likely look at the issue sooner:
8+
9+
* Post a full GitHub repository. Not a zip file, half baked snippet etc. If GitHub is new to you consider it a great learning opportunity and chance to get involved.
10+
* The repository should have just ONE step max for me to get running, and that is "Restore NuGet Packages". If there are any other missing dependencies, or uncompiling features I will most likely move on to another issue.
11+
* I'm not trying to be awkward. I'm just busy and I'm helping a lot of people, not just you, so help me out and I will help you out.
12+
13+

MainDemo.Wpf/MainWindow.xaml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@
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">
4242
<ToggleButton Style="{StaticResource MaterialDesignHamburgerToggleButton}"
43-
DockPanel.Dock="Top"
44-
HorizontalAlignment="Right" Margin="16"
45-
IsChecked="{Binding ElementName=MenuToggleButton, Path=IsChecked, Mode=TwoWay}" />
43+
DockPanel.Dock="Top"
44+
HorizontalAlignment="Right" Margin="16"
45+
IsChecked="{Binding ElementName=MenuToggleButton, Path=IsChecked, Mode=TwoWay}" />
4646
<ListBox x:Name="DemoItemsListBox" Margin="0 16 0 16" SelectedIndex="0"
47-
PreviewMouseLeftButtonUp="UIElement_OnPreviewMouseLeftButtonUp">
47+
PreviewMouseLeftButtonUp="UIElement_OnPreviewMouseLeftButtonUp">
4848
<ListBox.ItemTemplate>
4949
<DataTemplate DataType="domain:DemoItem">
5050
<TextBlock Text="{Binding Name}" Margin="32 0 32 0" />
@@ -178,6 +178,11 @@
178178
<materialDesignDemo:Drawers />
179179
</domain:DemoItem.Content>
180180
</domain:DemoItem>
181+
<domain:DemoItem Name="Snackbar">
182+
<domain:DemoItem.Content>
183+
<materialDesignDemo:Snackbars />
184+
</domain:DemoItem.Content>
185+
</domain:DemoItem>
181186
<domain:DemoItem Name="Transitions">
182187
<domain:DemoItem.Content>
183188
<materialDesignDemo:Transitions />
@@ -193,10 +198,10 @@
193198
</materialDesign:DrawerHost.LeftDrawerContent>
194199
<DockPanel>
195200
<materialDesign:ColorZone Padding="16" materialDesign:ShadowAssist.ShadowDepth="Depth2"
196-
Mode="PrimaryMid" DockPanel.Dock="Top">
201+
Mode="PrimaryMid" DockPanel.Dock="Top">
197202
<DockPanel>
198203
<ToggleButton Style="{StaticResource MaterialDesignHamburgerToggleButton}" IsChecked="False"
199-
x:Name="MenuToggleButton"/>
204+
x:Name="MenuToggleButton"/>
200205
<materialDesign:PopupBox DockPanel.Dock="Right" PlacementMode="BottomAndAlignRightEdges" StaysOpen="False">
201206
<StackPanel>
202207
<Button Content="Hello World" Click="MenuPopupButton_OnClick"/>
@@ -209,7 +214,10 @@
209214
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22">Material Design In XAML Toolkit</TextBlock>
210215
</DockPanel>
211216
</materialDesign:ColorZone>
212-
<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>
213221
</DockPanel>
214222
</materialDesign:DrawerHost>
215223
</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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@
157157
<Compile Include="Sliders.xaml.cs">
158158
<DependentUpon>Sliders.xaml</DependentUpon>
159159
</Compile>
160+
<Compile Include="Snackbars.xaml.cs">
161+
<DependentUpon>Snackbars.xaml</DependentUpon>
162+
</Compile>
160163
<Compile Include="TextFields.xaml.cs">
161164
<DependentUpon>TextFields.xaml</DependentUpon>
162165
</Compile>
@@ -305,6 +308,10 @@
305308
<SubType>Designer</SubType>
306309
<Generator>MSBuild:Compile</Generator>
307310
</Page>
311+
<Page Include="Snackbars.xaml">
312+
<SubType>Designer</SubType>
313+
<Generator>MSBuild:Compile</Generator>
314+
</Page>
308315
<Page Include="TextFields.xaml">
309316
<SubType>Designer</SubType>
310317
<Generator>MSBuild:Compile</Generator>

0 commit comments

Comments
 (0)