Skip to content

Commit 60a27c2

Browse files
committed
Merge remote-tracking branch 'refs/remotes/ButchersBoy/master' into DateTimePickerAnimation
2 parents 9e3ffe7 + 904ff09 commit 60a27c2

File tree

7 files changed

+427
-106
lines changed

7 files changed

+427
-106
lines changed

MainDemo.Wpf/Home.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
<Image Source="Resources/ms-icon-310x310.png" Stretch="Uniform" Width="100" Height="100" />
2020
<StackPanel Grid.Column="1" Margin="24 0 0 0">
2121
<TextBlock FontSize="32" TextWrapping="Wrap">Welcome to Material Design In XAML Toolkit</TextBlock>
22-
<TextBlock Margin="0 8 0 0" TextWrapping="Wrap" Foreground="{DynamicResource MaterialDesignBodyLight}">Use the left-hand menu to checkout the various controls &amp; themes.</TextBlock>
22+
<TextBlock Margin="0 8 0 10" TextWrapping="Wrap" Foreground="{DynamicResource MaterialDesignBodyLight}">Click EXPLORE to checkout the various controls &amp; themes.</TextBlock>
23+
<Button Command="{x:Static wpf:DrawerHost.OpenDrawerCommand}">EXPLORE</Button>
2324
</StackPanel>
2425
</Grid>
2526
<ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled"

MainDemo.Wpf/MainWindow.xaml

Lines changed: 109 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Shadows.xaml" />
2020
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ToggleButton.xaml" />
2121
</ResourceDictionary.MergedDictionaries>
22-
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
2322

2423
<!-- data template used for the dialogs example, defines a View for a ViewModel of type DateTime -->
2524
<DataTemplate DataType="{x:Type system:DateTime}">
@@ -34,107 +33,114 @@
3433
</Window.Resources>
3534

3635
<wpf:DialogHost Identifier="RootDialog">
37-
<DockPanel>
38-
<wpf:ColorZone Padding="16" wpf:ShadowAssist.ShadowDepth="Depth2"
39-
Mode="PrimaryMid" DockPanel.Dock="Top">
40-
<DockPanel>
41-
<ToggleButton Style="{StaticResource MaterialDesignHamburgerToggleButton}" IsChecked="True"
42-
x:Name="MenuToggleButton"/>
43-
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22">Material Design In XAML Toolkit</TextBlock>
44-
</DockPanel>
45-
</wpf:ColorZone>
46-
<ListBox DockPanel.Dock="Left" x:Name="DemoItemsListBox" Margin="16 16 0 16" SelectedIndex="0"
47-
Background="{DynamicResource PrimaryHueMidBrush}"
48-
Foreground="{DynamicResource PrimaryHueMidForegroundBrush}"
49-
Visibility="{Binding ElementName=MenuToggleButton, Path=IsChecked, Converter={StaticResource BooleanToVisibilityConverter}}">
50-
<ListBox.ItemTemplate>
51-
<DataTemplate DataType="domain:DemoItem">
52-
<TextBlock Text="{Binding Name}" />
53-
</DataTemplate>
54-
</ListBox.ItemTemplate>
55-
<domain:DemoItem Name="Home">
56-
<domain:DemoItem.Content>
57-
<wpfExample:Home />
58-
</domain:DemoItem.Content>
59-
</domain:DemoItem>
60-
<domain:DemoItem Name="Palette">
61-
<domain:DemoItem.Content>
62-
<wpfExample:PaletteSelector>
63-
<wpfExample:PaletteSelector.DataContext>
64-
<wpfExample:PaletteSelectorViewModel />
65-
</wpfExample:PaletteSelector.DataContext>
66-
</wpfExample:PaletteSelector>
67-
</domain:DemoItem.Content>
68-
</domain:DemoItem>
69-
<domain:DemoItem Name="Buttons &amp; Toggles">
70-
<domain:DemoItem.Content>
71-
<wpfExample:Buttons />
72-
</domain:DemoItem.Content>
73-
</domain:DemoItem>
74-
<domain:DemoItem Name="Fields">
75-
<domain:DemoItem.Content>
76-
<wpfExample:TextFields />
77-
</domain:DemoItem.Content>
78-
</domain:DemoItem>
79-
<domain:DemoItem Name="Cards">
80-
<domain:DemoItem.Content>
81-
<wpfExample:Cards />
82-
</domain:DemoItem.Content>
83-
</domain:DemoItem>
84-
<domain:DemoItem Name="Colour Zones">
85-
<domain:DemoItem.Content>
86-
<wpfExample:ColorZones />
87-
</domain:DemoItem.Content>
88-
</domain:DemoItem>
89-
<domain:DemoItem Name="Lists">
90-
<domain:DemoItem.Content>
91-
<wpfExample:Lists>
92-
<wpfExample:Lists.DataContext>
93-
<domain:ListsAndGridsViewModel />
94-
</wpfExample:Lists.DataContext>
95-
</wpfExample:Lists>
96-
</domain:DemoItem.Content>
97-
</domain:DemoItem>
98-
<domain:DemoItem Name="Trees">
99-
<domain:DemoItem.Content>
100-
<wpfExample:Trees />
101-
</domain:DemoItem.Content>
102-
</domain:DemoItem>
103-
<domain:DemoItem Name="Grids">
104-
<domain:DemoItem.Content>
105-
<wpfExample:Grids>
106-
<wpfExample:Grids.DataContext>
107-
<domain:ListsAndGridsViewModel />
108-
</wpfExample:Grids.DataContext>
109-
</wpfExample:Grids>
110-
</domain:DemoItem.Content>
111-
</domain:DemoItem>
112-
<domain:DemoItem Name="Menus &amp; Tool Bars">
113-
<domain:DemoItem.Content>
114-
<wpfExample:MenusAndToolBars />
115-
</domain:DemoItem.Content>
116-
</domain:DemoItem>
117-
<domain:DemoItem Name="Progress Indicators">
118-
<domain:DemoItem.Content>
119-
<wpfExample:Progress />
120-
</domain:DemoItem.Content>
121-
</domain:DemoItem>
122-
<domain:DemoItem Name="Dialogs">
123-
<domain:DemoItem.Content>
124-
<wpfExample:Dialogs>
125-
<wpfExample:Dialogs.DataContext>
126-
<domain:DialogsViewModel />
127-
</wpfExample:Dialogs.DataContext>
128-
</wpfExample:Dialogs>
129-
</domain:DemoItem.Content>
130-
</domain:DemoItem>
131-
<domain:DemoItem Name="Shadows">
132-
<domain:DemoItem.Content>
133-
<wpfExample:Shadows />
134-
</domain:DemoItem.Content>
135-
</domain:DemoItem>
136-
</ListBox>
137-
<ContentControl Margin="16" Content="{Binding ElementName=DemoItemsListBox, Path=SelectedItem.Content}" />
138-
</DockPanel>
36+
<wpf:DrawerHost IsLeftDrawerOpen="{Binding ElementName=MenuToggleButton, Path=IsChecked}">
37+
<wpf:DrawerHost.LeftDrawerContent>
38+
<StackPanel Orientation="Vertical">
39+
<ToggleButton Style="{StaticResource MaterialDesignHamburgerToggleButton}"
40+
HorizontalAlignment="Right" Margin="16"
41+
IsChecked="{Binding ElementName=MenuToggleButton, Path=IsChecked, Mode=TwoWay}" />
42+
<ListBox x:Name="DemoItemsListBox" Margin="0 16 0 16" SelectedIndex="0"
43+
PreviewMouseLeftButtonUp="UIElement_OnPreviewMouseLeftButtonUp">
44+
<ListBox.ItemTemplate>
45+
<DataTemplate DataType="domain:DemoItem">
46+
<TextBlock Text="{Binding Name}" Margin="32 0 32 0" />
47+
</DataTemplate>
48+
</ListBox.ItemTemplate>
49+
<domain:DemoItem Name="Home">
50+
<domain:DemoItem.Content>
51+
<wpfExample:Home />
52+
</domain:DemoItem.Content>
53+
</domain:DemoItem>
54+
<domain:DemoItem Name="Palette">
55+
<domain:DemoItem.Content>
56+
<wpfExample:PaletteSelector>
57+
<wpfExample:PaletteSelector.DataContext>
58+
<wpfExample:PaletteSelectorViewModel />
59+
</wpfExample:PaletteSelector.DataContext>
60+
</wpfExample:PaletteSelector>
61+
</domain:DemoItem.Content>
62+
</domain:DemoItem>
63+
<domain:DemoItem Name="Buttons &amp; Toggles">
64+
<domain:DemoItem.Content>
65+
<wpfExample:Buttons />
66+
</domain:DemoItem.Content>
67+
</domain:DemoItem>
68+
<domain:DemoItem Name="Fields">
69+
<domain:DemoItem.Content>
70+
<wpfExample:TextFields />
71+
</domain:DemoItem.Content>
72+
</domain:DemoItem>
73+
<domain:DemoItem Name="Cards">
74+
<domain:DemoItem.Content>
75+
<wpfExample:Cards />
76+
</domain:DemoItem.Content>
77+
</domain:DemoItem>
78+
<domain:DemoItem Name="Colour Zones">
79+
<domain:DemoItem.Content>
80+
<wpfExample:ColorZones />
81+
</domain:DemoItem.Content>
82+
</domain:DemoItem>
83+
<domain:DemoItem Name="Lists">
84+
<domain:DemoItem.Content>
85+
<wpfExample:Lists>
86+
<wpfExample:Lists.DataContext>
87+
<domain:ListsAndGridsViewModel />
88+
</wpfExample:Lists.DataContext>
89+
</wpfExample:Lists>
90+
</domain:DemoItem.Content>
91+
</domain:DemoItem>
92+
<domain:DemoItem Name="Trees">
93+
<domain:DemoItem.Content>
94+
<wpfExample:Trees />
95+
</domain:DemoItem.Content>
96+
</domain:DemoItem>
97+
<domain:DemoItem Name="Grids">
98+
<domain:DemoItem.Content>
99+
<wpfExample:Grids>
100+
<wpfExample:Grids.DataContext>
101+
<domain:ListsAndGridsViewModel />
102+
</wpfExample:Grids.DataContext>
103+
</wpfExample:Grids>
104+
</domain:DemoItem.Content>
105+
</domain:DemoItem>
106+
<domain:DemoItem Name="Menus &amp; Tool Bars">
107+
<domain:DemoItem.Content>
108+
<wpfExample:MenusAndToolBars />
109+
</domain:DemoItem.Content>
110+
</domain:DemoItem>
111+
<domain:DemoItem Name="Progress Indicators">
112+
<domain:DemoItem.Content>
113+
<wpfExample:Progress />
114+
</domain:DemoItem.Content>
115+
</domain:DemoItem>
116+
<domain:DemoItem Name="Dialogs">
117+
<domain:DemoItem.Content>
118+
<wpfExample:Dialogs>
119+
<wpfExample:Dialogs.DataContext>
120+
<domain:DialogsViewModel />
121+
</wpfExample:Dialogs.DataContext>
122+
</wpfExample:Dialogs>
123+
</domain:DemoItem.Content>
124+
</domain:DemoItem>
125+
<domain:DemoItem Name="Shadows">
126+
<domain:DemoItem.Content>
127+
<wpfExample:Shadows />
128+
</domain:DemoItem.Content>
129+
</domain:DemoItem>
130+
</ListBox>
131+
</StackPanel>
132+
</wpf:DrawerHost.LeftDrawerContent>
133+
<DockPanel>
134+
<wpf:ColorZone Padding="16" wpf:ShadowAssist.ShadowDepth="Depth2"
135+
Mode="PrimaryMid" DockPanel.Dock="Top">
136+
<DockPanel>
137+
<ToggleButton Style="{StaticResource MaterialDesignHamburgerToggleButton}" IsChecked="False"
138+
x:Name="MenuToggleButton"/>
139+
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22">Material Design In XAML Toolkit</TextBlock>
140+
</DockPanel>
141+
</wpf:ColorZone>
142+
<ContentControl Margin="16" Content="{Binding ElementName=DemoItemsListBox, Path=SelectedItem.Content}" />
143+
</DockPanel>
144+
</wpf:DrawerHost>
139145
</wpf:DialogHost>
140146
</Window>

MainDemo.Wpf/MainWindow.xaml.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Windows;
2+
using System.Windows.Input;
23

34
namespace MaterialDesignColors.WpfExample
45
{
@@ -11,5 +12,10 @@ public MainWindow()
1112
{
1213
InitializeComponent();
1314
}
15+
16+
private void UIElement_OnPreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
17+
{
18+
MenuToggleButton.IsChecked = false;
19+
}
1420
}
1521
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Globalization;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using System.Windows.Data;
8+
9+
namespace MaterialDesignThemes.Wpf.Converters
10+
{
11+
public class DrawerOffsetConverter : IValueConverter
12+
{
13+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
14+
{
15+
var d = value as double? ?? 0;
16+
if (double.IsInfinity(d) || double.IsNaN(d)) d = 0;
17+
return 0 - d;
18+
}
19+
20+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
21+
{
22+
throw new NotImplementedException();
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)