Skip to content

Commit eefb226

Browse files
committed
Merge pull request #7 from ButchersBoy/master
update from original repo
2 parents 4bdf4d9 + ae4502b commit eefb226

23 files changed

+742
-403
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
@@ -122,6 +122,9 @@
122122
<Compile Include="Shadows.xaml.cs">
123123
<DependentUpon>Shadows.xaml</DependentUpon>
124124
</Compile>
125+
<Compile Include="Sliders.xaml.cs">
126+
<DependentUpon>Sliders.xaml</DependentUpon>
127+
</Compile>
125128
<Compile Include="TextFields.xaml.cs">
126129
<DependentUpon>TextFields.xaml</DependentUpon>
127130
</Compile>
@@ -204,6 +207,10 @@
204207
<SubType>Designer</SubType>
205208
<Generator>MSBuild:Compile</Generator>
206209
</Page>
210+
<Page Include="Sliders.xaml">
211+
<SubType>Designer</SubType>
212+
<Generator>MSBuild:Compile</Generator>
213+
</Page>
207214
<Page Include="TextFields.xaml">
208215
<SubType>Designer</SubType>
209216
<Generator>MSBuild:Compile</Generator>

MainDemo.Wpf/MainWindow.xaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@
7070
<wpfExample:TextFields />
7171
</domain:DemoItem.Content>
7272
</domain:DemoItem>
73+
<domain:DemoItem Name="Sliders">
74+
<domain:DemoItem.Content>
75+
<wpfExample:Sliders />
76+
</domain:DemoItem.Content>
77+
</domain:DemoItem>
7378
<domain:DemoItem Name="Cards">
7479
<domain:DemoItem.Content>
7580
<wpfExample:Cards />

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)