Skip to content

Commit c8e0645

Browse files
committed
merge with original master
2 parents f9fc5c2 + eefb226 commit c8e0645

23 files changed

+821
-482
lines changed

MainDemo.Wpf/Domain/DialogsViewModel.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,17 @@ private async void ExecuteRunExtendedDialog(object o)
5757
};
5858

5959
//show the dialog
60-
var result = await DialogHost.Show(view, "RootDialog", ExtendedClosingEventHandler);
60+
var result = await DialogHost.Show(view, "RootDialog", ExtendedOpenedEventHandler, ExtendedClosingEventHandler);
6161

6262
//check the result...
6363
Console.WriteLine("Dialog was closed, the CommandParameter used to close it was: " + (result ?? "NULL"));
6464
}
6565

66+
private void ExtendedOpenedEventHandler(object sender, DialogOpenedEventArgs eventargs)
67+
{
68+
Console.WriteLine("You could intercept the open and affect the dialog using eventArgs.Session.");
69+
}
70+
6671
private void ExtendedClosingEventHandler(object sender, DialogClosingEventArgs eventArgs)
6772
{
6873
if ((bool)eventArgs.Parameter == false) return;

MainDemo.Wpf/MainDemo.Wpf.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@
125125
<Compile Include="Shadows.xaml.cs">
126126
<DependentUpon>Shadows.xaml</DependentUpon>
127127
</Compile>
128+
<Compile Include="Sliders.xaml.cs">
129+
<DependentUpon>Sliders.xaml</DependentUpon>
130+
</Compile>
128131
<Compile Include="TextFields.xaml.cs">
129132
<DependentUpon>TextFields.xaml</DependentUpon>
130133
</Compile>
@@ -211,6 +214,10 @@
211214
<SubType>Designer</SubType>
212215
<Generator>MSBuild:Compile</Generator>
213216
</Page>
217+
<Page Include="Sliders.xaml">
218+
<SubType>Designer</SubType>
219+
<Generator>MSBuild:Compile</Generator>
220+
</Page>
214221
<Page Include="TextFields.xaml">
215222
<SubType>Designer</SubType>
216223
<Generator>MSBuild:Compile</Generator>

MainDemo.Wpf/MainWindow.xaml

Lines changed: 84 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -41,83 +41,88 @@
4141
IsChecked="{Binding ElementName=MenuToggleButton, Path=IsChecked, Mode=TwoWay}" />
4242
<ListBox x:Name="DemoItemsListBox" Margin="0 16 0 16" SelectedIndex="0"
4343
PreviewMouseLeftButtonUp="UIElement_OnPreviewMouseLeftButtonUp">
44-
<ListBox.ItemTemplate>
45-
<DataTemplate DataType="domain:DemoItem">
44+
<ListBox.ItemTemplate>
45+
<DataTemplate DataType="domain:DemoItem">
4646
<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="Expander">
107-
<domain:DemoItem.Content>
108-
<wpfExample:Expander />
109-
</domain:DemoItem.Content>
110-
</domain:DemoItem>
111-
<domain:DemoItem Name="Menus &amp; Tool Bars">
112-
<domain:DemoItem.Content>
113-
<wpfExample:MenusAndToolBars />
114-
</domain:DemoItem.Content>
115-
</domain:DemoItem>
116-
<domain:DemoItem Name="Progress Indicators">
117-
<domain:DemoItem.Content>
118-
<wpfExample:Progress />
119-
</domain:DemoItem.Content>
120-
</domain:DemoItem>
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="Sliders">
74+
<domain:DemoItem.Content>
75+
<wpfExample:Sliders />
76+
</domain:DemoItem.Content>
77+
</domain:DemoItem>
78+
<domain:DemoItem Name="Cards">
79+
<domain:DemoItem.Content>
80+
<wpfExample:Cards />
81+
</domain:DemoItem.Content>
82+
</domain:DemoItem>
83+
<domain:DemoItem Name="Colour Zones">
84+
<domain:DemoItem.Content>
85+
<wpfExample:ColorZones />
86+
</domain:DemoItem.Content>
87+
</domain:DemoItem>
88+
<domain:DemoItem Name="Lists">
89+
<domain:DemoItem.Content>
90+
<wpfExample:Lists>
91+
<wpfExample:Lists.DataContext>
92+
<domain:ListsAndGridsViewModel />
93+
</wpfExample:Lists.DataContext>
94+
</wpfExample:Lists>
95+
</domain:DemoItem.Content>
96+
</domain:DemoItem>
97+
<domain:DemoItem Name="Trees">
98+
<domain:DemoItem.Content>
99+
<wpfExample:Trees />
100+
</domain:DemoItem.Content>
101+
</domain:DemoItem>
102+
<domain:DemoItem Name="Grids">
103+
<domain:DemoItem.Content>
104+
<wpfExample:Grids>
105+
<wpfExample:Grids.DataContext>
106+
<domain:ListsAndGridsViewModel />
107+
</wpfExample:Grids.DataContext>
108+
</wpfExample:Grids>
109+
</domain:DemoItem.Content>
110+
</domain:DemoItem>
111+
<domain:DemoItem Name="Expander">
112+
<domain:DemoItem.Content>
113+
<wpfExample:Expander />
114+
</domain:DemoItem.Content>
115+
</domain:DemoItem>
116+
<domain:DemoItem Name="Menus &amp; Tool Bars">
117+
<domain:DemoItem.Content>
118+
<wpfExample:MenusAndToolBars />
119+
</domain:DemoItem.Content>
120+
</domain:DemoItem>
121+
<domain:DemoItem Name="Progress Indicators">
122+
<domain:DemoItem.Content>
123+
<wpfExample:Progress />
124+
</domain:DemoItem.Content>
125+
</domain:DemoItem>
121126
<domain:DemoItem Name="Dialogs">
122127
<domain:DemoItem.Content>
123128
<wpfExample:Dialogs>
@@ -132,7 +137,7 @@
132137
<wpfExample:Shadows />
133138
</domain:DemoItem.Content>
134139
</domain:DemoItem>
135-
</ListBox>
140+
</ListBox>
136141
</StackPanel>
137142
</wpf:DrawerHost.LeftDrawerContent>
138143
<DockPanel>
@@ -144,8 +149,8 @@
144149
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22">Material Design In XAML Toolkit</TextBlock>
145150
</DockPanel>
146151
</wpf:ColorZone>
147-
<ContentControl Margin="16" Content="{Binding ElementName=DemoItemsListBox, Path=SelectedItem.Content}" />
148-
</DockPanel>
152+
<ContentControl Margin="16" Content="{Binding ElementName=DemoItemsListBox, Path=SelectedItem.Content}" />
153+
</DockPanel>
149154
</wpf:DrawerHost>
150155
</wpf:DialogHost>
151156
</Window>

MainDemo.Wpf/ProvingGround.xaml

Lines changed: 15 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -9,62 +9,29 @@
99
Background="{DynamicResource MaterialDesignPaper}"
1010
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"
1111
mc:Ignorable="d"
12-
d:DesignWidth="200" d:DesignHeight="120">
12+
d:DesignWidth="477" d:DesignHeight="272">
1313
<UserControl.Resources>
1414
<ResourceDictionary>
1515
<ResourceDictionary.MergedDictionaries>
16-
17-
<!-- light or dark theme -->
1816
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
19-
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Shadows.xaml" />
20-
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
21-
22-
<!-- primary color -->
23-
<ResourceDictionary>
24-
<!-- include your primary palette -->
25-
<ResourceDictionary.MergedDictionaries>
26-
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/MaterialDesignColor.Indigo.xaml" />
27-
</ResourceDictionary.MergedDictionaries>
28-
<!--
29-
include three hues from the primary palette (and the associated forecolours).
30-
Do not rename, keep in sequence; light to dark.
31-
-->
32-
<SolidColorBrush x:Key="PrimaryHueLightBrush" Color="{StaticResource Primary100}"/>
33-
<SolidColorBrush x:Key="PrimaryHueLightForegroundBrush" Color="{StaticResource Primary100Foreground}"/>
34-
<SolidColorBrush x:Key="PrimaryHueMidBrush" Color="{StaticResource Primary500}"/>
35-
<SolidColorBrush x:Key="PrimaryHueMidForegroundBrush" Color="{StaticResource Primary500Foreground}"/>
36-
<SolidColorBrush x:Key="PrimaryHueDarkBrush" Color="{StaticResource Primary700}"/>
37-
<SolidColorBrush x:Key="PrimaryHueDarkForegroundBrush" Color="{StaticResource Primary700Foreground}"/>
38-
</ResourceDictionary>
39-
40-
<!-- secondary colour -->
41-
<ResourceDictionary>
42-
<!-- include your secondary pallette -->
43-
<ResourceDictionary.MergedDictionaries>
44-
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/MaterialDesignColor.Yellow.xaml" />
45-
</ResourceDictionary.MergedDictionaries>
46-
47-
<!-- include a single secondary accent color (and the associated forecolour) -->
48-
<SolidColorBrush x:Key="SecondaryAccentBrush" Color="{StaticResource Accent700}"/>
49-
<SolidColorBrush x:Key="SecondaryAccentForegroundBrush" Color="{StaticResource Accent700Foreground}"/>
50-
</ResourceDictionary>
17+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Slider.xaml" />
18+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
19+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
5120
</ResourceDictionary.MergedDictionaries>
52-
53-
54-
5521
</ResourceDictionary>
56-
57-
58-
5922
</UserControl.Resources>
6023

61-
62-
<Grid>
63-
<wpf:Clock DisplayAutomation="None" Is24Hours="False" VerticalAlignment="Center" HorizontalAlignment="Center">
64-
</wpf:Clock>
65-
66-
</Grid>
67-
6824

25+
<StackPanel Margin="24 0 0 0" HorizontalAlignment="Stretch">
26+
<StackPanel Orientation="Horizontal">
27+
<TextBlock VerticalAlignment="Bottom">Try me</TextBlock>
28+
<Slider Minimum="0" Maximum="100" Style="{StaticResource MaterialDesignDiscreteSlider}"
29+
Value="50"
30+
Width="280"
31+
Margin="8 0 0 0"/>
32+
</StackPanel>
33+
<Slider Minimum="0" Maximum="10" Margin="0 24 0 0" Style="{StaticResource MaterialDesignDiscreteSlider}" />
34+
<Slider Minimum="0" Maximum="10" Margin="0 24 0 0" Style="{StaticResource MaterialDesignDiscreteSlider}" />
35+
</StackPanel>
6936

7037
</UserControl>

MainDemo.Wpf/Sliders.xaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<UserControl x:Class="MaterialDesignColors.WpfExample.Sliders"
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+
mc:Ignorable="d"
8+
d:DesignHeight="300" d:DesignWidth="300">
9+
10+
<UserControl.Resources>
11+
<ResourceDictionary>
12+
<ResourceDictionary.MergedDictionaries>
13+
<!-- note you only need bring in these extra resource dictionaries when using non-default styles, so only bring them into your controls where the default style is not what you want -->
14+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Slider.xaml" />
15+
</ResourceDictionary.MergedDictionaries>
16+
</ResourceDictionary>
17+
</UserControl.Resources>
18+
19+
<Grid VerticalAlignment="Top">
20+
<Grid.ColumnDefinitions>
21+
<ColumnDefinition />
22+
<ColumnDefinition />
23+
</Grid.ColumnDefinitions>
24+
<Grid.RowDefinitions>
25+
<RowDefinition Height="Auto" />
26+
<RowDefinition Height="Auto" />
27+
<RowDefinition Height="Auto" />
28+
<RowDefinition Height="Auto" />
29+
<RowDefinition Height="Auto" />
30+
<RowDefinition Height="Auto" />
31+
</Grid.RowDefinitions>
32+
<Slider Grid.Row="0" TickFrequency="5" Orientation="Horizontal" Minimum="1" Maximum="50" Value="25" />
33+
<StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="1" Grid.RowSpan="3"
34+
Margin="0 36 0 0">
35+
<Slider TickFrequency="5" TickPlacement="BottomRight" Orientation="Vertical" Minimum="1" Maximum="50" />
36+
<Slider TickFrequency="25" TickPlacement="TopLeft" Orientation="Vertical" Minimum="1" Maximum="50" IsEnabled="False" Margin="24 8 0 8" />
37+
</StackPanel>
38+
<Slider Grid.Row="1" TickFrequency="5" Orientation="Horizontal" TickPlacement="BottomRight" Minimum="1" Maximum="50" Value="25" IsSelectionRangeEnabled="True"
39+
Margin="0 36 0 0" />
40+
<Slider Grid.Row="2" TickFrequency="5" Orientation="Horizontal" TickPlacement="BottomRight" Minimum="1" Maximum="50" Value="25" IsEnabled="False"
41+
Margin="0 36 0 0" />
42+
43+
<StackPanel Orientation="Horizontal" Grid.Row="3" Margin="0 16 0 0">
44+
<TextBlock VerticalAlignment="Bottom">Try me</TextBlock>
45+
<Slider Minimum="0" Maximum="100" Style="{StaticResource MaterialDesignDiscreteSlider}"
46+
Value="50"
47+
Width="280"
48+
Margin="8 0 0 0"/>
49+
</StackPanel>
50+
<Slider Minimum="0" Maximum="10" Margin="0 24 0 0" Style="{StaticResource MaterialDesignDiscreteSlider}" Grid.Row="4" Width="260" HorizontalAlignment="Left" />
51+
<Slider Minimum="0" Maximum="10" Margin="0 24 0 0" Style="{StaticResource MaterialDesignDiscreteSlider}" Grid.Row="5" Width="260" HorizontalAlignment="Left" />
52+
53+
</Grid>
54+
</UserControl>

MainDemo.Wpf/Sliders.xaml.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Windows;
7+
using System.Windows.Controls;
8+
using System.Windows.Data;
9+
using System.Windows.Documents;
10+
using System.Windows.Input;
11+
using System.Windows.Media;
12+
using System.Windows.Media.Imaging;
13+
using System.Windows.Navigation;
14+
using System.Windows.Shapes;
15+
16+
namespace MaterialDesignColors.WpfExample
17+
{
18+
/// <summary>
19+
/// Interaction logic for Sliders.xaml
20+
/// </summary>
21+
public partial class Sliders : UserControl
22+
{
23+
public Sliders()
24+
{
25+
InitializeComponent();
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)