Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions MahMaterialDragablzMashUp/PaletteSelector.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
xmlns:mahMaterialDragablzMashUp="clr-namespace:MahMaterialDragablzMashUp"
xmlns:materialDesignColors="clr-namespace:MaterialDesignColors;assembly=MaterialDesignColors"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf"
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf" xmlns:materialDesignMahApps="http://materialdesigninxaml.net/winfx/xaml/themes"
d:DataContext="{d:DesignInstance mahMaterialDragablzMashUp:PaletteSelectorViewModel,
IsDesignTimeCreatable=False}"
d:DesignHeight="300"
d:DesignWidth="300"
mc:Ignorable="d">
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
<materialDesignMahApps:NullableToVisibilityConverter x:Key="NullableToVisibilityConverter" />
<Style TargetType="Button" BasedOn="{StaticResource MaterialDesignFlatButton}">
<Setter Property="CommandParameter" Value="{Binding}" />
<Setter Property="Foreground">
Expand Down Expand Up @@ -66,13 +67,13 @@
<Border Grid.Row="1"
Grid.Column="1"
Width="120"
Visibility="{Binding IsAccented, Converter={StaticResource BooleanToVisibilityConverter}, Mode=OneTime}">
Visibility="{Binding SecondaryExemplarHue, Converter={StaticResource NullableToVisibilityConverter}, Mode=OneTime}">
<Border.Background>
<SolidColorBrush Color="{Binding AccentExemplarHue.Color, Mode=OneTime}" />
<SolidColorBrush Color="{Binding SecondaryExemplarHue.Color, Mode=OneTime}" />
</Border.Background>
<Button Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type mahMaterialDragablzMashUp:PaletteSelector}}, Path=DataContext.ApplyAccentCommand, Mode=OneTime}" CommandParameter="{Binding}">
<Button Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type mahMaterialDragablzMashUp:PaletteSelector}}, Path=DataContext.ApplySecondaryCommand, Mode=OneTime}" CommandParameter="{Binding}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="Accent" />
<TextBlock Text="Secondary" />
<Viewbox Width="16" Height="16">
<Canvas Width="24" Height="24">
<Path Style="{StaticResource PalettePath}" />
Expand Down
8 changes: 4 additions & 4 deletions MahMaterialDragablzMashUp/PaletteSelectorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public PaletteSelectorViewModel()

public ICommand ApplyPrimaryCommand { get; } = new AnotherCommandImplementation(o => ApplyPrimary((Swatch)o!));

public ICommand ApplyAccentCommand { get; } = new AnotherCommandImplementation(o => ApplyAccent((Swatch)o!));
public ICommand ApplySecondaryCommand { get; } = new AnotherCommandImplementation(o => ApplySecondary((Swatch)o!));

private bool _isDarkTheme;
public bool IsDarkTheme
Expand Down Expand Up @@ -64,11 +64,11 @@ private static void ApplyBase(bool isDark)
private static void ApplyPrimary(Swatch swatch)
=> ModifyTheme(theme => theme.SetPrimaryColor(swatch.ExemplarHue.Color));

private static void ApplyAccent(Swatch swatch)
private static void ApplySecondary(Swatch swatch)
{
if (swatch.AccentExemplarHue is Hue accentHue)
if (swatch.SecondaryExemplarHue is Hue secondaryHue)
{
ModifyTheme(theme => theme.SetSecondaryColor(accentHue.Color));
ModifyTheme(theme => theme.SetSecondaryColor(secondaryHue.Color));
}
}

Expand Down
2 changes: 1 addition & 1 deletion MainDemo.Wpf/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<!--
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Secondary/MaterialDesignColor.Lime.xaml" />
-->


Expand Down
4 changes: 2 additions & 2 deletions MainDemo.Wpf/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ protected override void OnStartup(StartupEventArgs e)

//This is an alternate way to initialize MaterialDesignInXAML if you don't use the MaterialDesignResourceDictionary in App.xaml
//Color primaryColor = SwatchHelper.Lookup[MaterialDesignColor.DeepPurple];
//Color accentColor = SwatchHelper.Lookup[MaterialDesignColor.Lime];
//ITheme theme = Theme.Create(new MaterialDesignLightTheme(), primaryColor, accentColor);
//Color secondaryColor = SwatchHelper.Lookup[MaterialDesignColor.Lime];
//ITheme theme = Theme.Create(new MaterialDesignLightTheme(), primaryColor, secondaryColor);
//Resources.SetTheme(theme);


Expand Down
8 changes: 4 additions & 4 deletions MainDemo.Wpf/Domain/PaletteSelectorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ public PaletteSelectorViewModel()
private static void ApplyPrimary(Swatch swatch)
=> ModifyTheme(theme => theme.SetPrimaryColor(swatch.ExemplarHue.Color));

public ICommand ApplyAccentCommand { get; } = new AnotherCommandImplementation(o => ApplyAccent((Swatch)o!));
public ICommand ApplySecondaryCommand { get; } = new AnotherCommandImplementation(o => ApplySecondary((Swatch)o!));

private static void ApplyAccent(Swatch swatch)
private static void ApplySecondary(Swatch swatch)
{
if (swatch is { AccentExemplarHue: not null })
if (swatch is { SecondaryExemplarHue: not null })
{
ModifyTheme(theme => theme.SetSecondaryColor(swatch.AccentExemplarHue.Color));
ModifyTheme(theme => theme.SetSecondaryColor(swatch.SecondaryExemplarHue.Color));
}
}

Expand Down
2 changes: 1 addition & 1 deletion MainDemo.Wpf/Palette.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
Grid.Column="0"
Grid.ColumnSpan="3"
Background="{DynamicResource SecondaryHueMidBrush}">
<TextBlock Foreground="{DynamicResource SecondaryHueMidForegroundBrush}" Text="Accent" />
<TextBlock Foreground="{DynamicResource SecondaryHueMidForegroundBrush}" Text="Secondary" />
</Border>
</Grid>
</UserControl>
11 changes: 6 additions & 5 deletions MainDemo.Wpf/PaletteSelector.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
xmlns:local="clr-namespace:MaterialDesignDemo"
xmlns:materialDesignColors="clr-namespace:MaterialDesignColors;assembly=MaterialDesignColors"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf"
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
d:DataContext="{d:DesignInstance domain:PaletteSelectorViewModel}"
d:DesignHeight="300"
d:DesignWidth="400"
mc:Ignorable="d">
<UserControl.Resources>
<materialDesign:NullableToVisibilityConverter x:Key="NullableToVisibilityConverter" />
<DataTemplate DataType="{x:Type materialDesignColors:Swatch}">
<DataTemplate.Resources>
<Style TargetType="Button" BasedOn="{StaticResource MaterialDesignFlatButton}">
Expand Down Expand Up @@ -72,14 +73,14 @@
<Border Grid.Row="1"
Grid.Column="1"
Width="120"
Visibility="{Binding IsAccented, Converter={StaticResource BooleanToVisibilityConverter}, Mode=OneTime}">
Visibility="{Binding SecondaryExemplarHue, Converter={StaticResource NullableToVisibilityConverter}, Mode=OneTime}">
<Border.Background>
<SolidColorBrush Color="{Binding AccentExemplarHue.Color, Mode=OneTime}" />
<SolidColorBrush Color="{Binding SecondaryExemplarHue.Color, Mode=OneTime}" />
</Border.Background>

<Button Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:PaletteSelector}}, Path=DataContext.ApplyAccentCommand, Mode=OneTime}" CommandParameter="{Binding}">
<Button Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:PaletteSelector}}, Path=DataContext.ApplySecondaryCommand, Mode=OneTime}" CommandParameter="{Binding}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="Accent" />
<TextBlock Text="Secondary" />
<Viewbox Width="16" Height="16">
<Canvas Width="24" Height="24">
<Path Style="{StaticResource PalettePath}" />
Expand Down
2 changes: 1 addition & 1 deletion MaterialDesign3.Demo.Wpf/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<!-- You can also use the built in theme dictionaries as well
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Secondary/MaterialDesignColor.Lime.xaml" />
-->

<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Defaults.xaml" />
Expand Down
4 changes: 2 additions & 2 deletions MaterialDesign3.Demo.Wpf/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ protected override void OnStartup(StartupEventArgs e)

//This is an alternate way to initialize MaterialDesignInXAML if you don't use the MaterialDesignResourceDictionary in App.xaml
//Color primaryColor = SwatchHelper.Lookup[MaterialDesignColor.DeepPurple];
//Color accentColor = SwatchHelper.Lookup[MaterialDesignColor.Lime];
//ITheme theme = Theme.Create(new MaterialDesignLightTheme(), primaryColor, accentColor);
//Color secondaryColor = SwatchHelper.Lookup[MaterialDesignColor.Lime];
//ITheme theme = Theme.Create(new MaterialDesignLightTheme(), primaryColor, secondaryColor);
//Resources.SetTheme(theme);


Expand Down
6 changes: 3 additions & 3 deletions MaterialDesign3.Demo.Wpf/Buttons.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@
Content="MID"
IsEnabled="{Binding DataContext.ControlsEnabled, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}"
Style="{StaticResource MaterialDesignFlatSecondaryMidBgButton}"
ToolTip="MaterialDesignFlatAccentBackgroundButton" />
ToolTip="MaterialDesignFlatSecondaryMidBgButton" />
</smtx:XamlDisplay>

<smtx:XamlDisplay Margin="8,0" UniqueKey="buttons_flat_bg_6">
Expand Down Expand Up @@ -894,10 +894,10 @@
<smtx:XamlDisplay Margin="8,0,0,5" UniqueKey="buttons_11">
<materialDesign:PopupBox IsEnabled="{Binding DataContext.ControlsEnabled, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}"
PlacementMode="BottomAndAlignCentres"
Style="{StaticResource MaterialDesignMultiFloatingActionAccentPopupBox}"
Style="{StaticResource MaterialDesignMultiFloatingActionSecondaryPopupBox}"
ToggleCheckedContentCommand="{Binding FloatingActionDemoCommand}"
ToggleCheckedContentCommandParameter="wowsers"
ToolTip="PopupBox, Style MaterialDesignMultiFloatingActionAccentPopupBox">
ToolTip="PopupBox, Style MaterialDesignMultiFloatingActionSecondaryPopupBox">
<materialDesign:PopupBox.ToggleCheckedContent>
<materialDesign:PackIcon Width="24"
Height="24"
Expand Down
16 changes: 8 additions & 8 deletions MaterialDesign3.Demo.Wpf/Chips.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
</smtx:XamlDisplay>

<smtx:XamlDisplay Margin="0,0,4,4" UniqueKey="chips_12">
<CheckBox IsChecked="True" Style="{StaticResource MaterialDesignFilterChipAccentCheckBox}">Secondary</CheckBox>
<CheckBox IsChecked="True" Style="{StaticResource MaterialDesignFilterChipSecondaryCheckBox}">Secondary</CheckBox>
</smtx:XamlDisplay>
</WrapPanel>

Expand All @@ -179,7 +179,7 @@
<smtx:XamlDisplay Margin="0,0,4,4" UniqueKey="chips_15">
<CheckBox Content="Secondary Outline"
IsChecked="True"
Style="{StaticResource MaterialDesignFilterChipAccentOutlineCheckBox}" />
Style="{StaticResource MaterialDesignFilterChipSecondaryOutlineCheckBox}" />
</smtx:XamlDisplay>
</WrapPanel>

Expand Down Expand Up @@ -208,7 +208,7 @@

<materialDesign:Card Margin="4">
<smtx:XamlDisplay Margin="4" UniqueKey="chips_18">
<ListBox Style="{StaticResource MaterialDesignFilterChipAccentListBox}">
<ListBox Style="{StaticResource MaterialDesignFilterChipSecondaryListBox}">
<ListBoxItem Content="Mercury" />
<ListBoxItem Content="Venus" IsSelected="True" />
<ListBoxItem Content="Earth" />
Expand Down Expand Up @@ -243,7 +243,7 @@

<materialDesign:Card Margin="4">
<smtx:XamlDisplay Margin="4" UniqueKey="chips_21">
<ListBox Style="{StaticResource MaterialDesignFilterChipAccentOutlineListBox}">
<ListBox Style="{StaticResource MaterialDesignFilterChipSecondaryOutlineListBox}">
<ListBoxItem Content="Mercury" />
<ListBoxItem Content="Venus" IsSelected="True" />
<ListBoxItem Content="Earth" />
Expand Down Expand Up @@ -279,7 +279,7 @@
<smtx:XamlDisplay Margin="0,0,4,4" UniqueKey="chips_24">
<RadioButton Content="Secondary"
GroupName="GroupChoiceChip"
Style="{StaticResource MaterialDesignChoiceChipAccentRadioButton}" />
Style="{StaticResource MaterialDesignChoiceChipSecondaryRadioButton}" />
</smtx:XamlDisplay>
</WrapPanel>

Expand All @@ -300,7 +300,7 @@
<smtx:XamlDisplay Margin="0,0,4,4" UniqueKey="chips_27">
<RadioButton Content="Secondary Outline"
GroupName="GroupChoiceChipOutline"
Style="{StaticResource MaterialDesignChoiceChipAccentOutlineRadioButton}" />
Style="{StaticResource MaterialDesignChoiceChipSecondaryOutlineRadioButton}" />
</smtx:XamlDisplay>
</WrapPanel>

Expand Down Expand Up @@ -329,7 +329,7 @@

<materialDesign:Card Margin="4">
<smtx:XamlDisplay Margin="0,0,6,4" UniqueKey="chips_30">
<ListBox x:Name="RadioButtonGroupChoiceChipAccent" Style="{StaticResource MaterialDesignChoiceChipAccentListBox}">
<ListBox x:Name="RadioButtonGroupChoiceChipSecondary" Style="{StaticResource MaterialDesignChoiceChipSecondaryListBox}">
<ListBoxItem Content="Mercury" />
<ListBoxItem Content="Venus" IsSelected="True" />
<ListBoxItem Content="Earth" />
Expand Down Expand Up @@ -364,7 +364,7 @@

<materialDesign:Card Margin="4">
<smtx:XamlDisplay Margin="0,0,6,4" UniqueKey="chips_33">
<ListBox x:Name="RadioButtonGroupChoiceChipAccentOutline" Style="{StaticResource MaterialDesignChoiceChipAccentOutlineListBox}">
<ListBox x:Name="RadioButtonGroupChoiceChipSecondaryOutline" Style="{StaticResource MaterialDesignChoiceChipSecondaryOutlineListBox}">
<ListBoxItem Content="Mercury" />
<ListBoxItem Content="Venus" IsSelected="True" />
<ListBoxItem Content="Earth" />
Expand Down
8 changes: 4 additions & 4 deletions MaterialDesign3.Demo.Wpf/Domain/PaletteSelectorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ public PaletteSelectorViewModel()
private static void ApplyPrimary(Swatch swatch)
=> ModifyTheme(theme => theme.SetPrimaryColor(swatch.ExemplarHue.Color));

public ICommand ApplyAccentCommand { get; } = new AnotherCommandImplementation(o => ApplyAccent((Swatch)o!));
public ICommand ApplySecondaryCommand { get; } = new AnotherCommandImplementation(o => ApplySecondary((Swatch)o!));

private static void ApplyAccent(Swatch swatch)
private static void ApplySecondary(Swatch swatch)
{
if (swatch is { AccentExemplarHue: not null })
if (swatch is { SecondaryExemplarHue: not null })
{
ModifyTheme(theme => theme.SetSecondaryColor(swatch.AccentExemplarHue.Color));
ModifyTheme(theme => theme.SetSecondaryColor(swatch.SecondaryExemplarHue.Color));
}
}

Expand Down
4 changes: 2 additions & 2 deletions MaterialDesign3.Demo.Wpf/GroupBoxes.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
UniqueKey="groupbox_4">
<GroupBox Margin="16"
materialDesign:ColorZoneAssist.Mode="SecondaryMid"
Header="Accent Header"
Header="Secondary Header"
Style="{StaticResource MaterialDesignGroupBox}">
<TextBlock Text="My Content" />
</GroupBox>
Expand Down Expand Up @@ -120,7 +120,7 @@
UniqueKey="groupbox_7">
<GroupBox Margin="16"
materialDesign:ColorZoneAssist.Mode="SecondaryMid"
Header="Card Group Box Accent"
Header="Card Group Box Secondary"
Style="{StaticResource MaterialDesignCardGroupBox}">
<GroupBox.HeaderTemplate>
<DataTemplate>
Expand Down
2 changes: 1 addition & 1 deletion MaterialDesign3.Demo.Wpf/Palette.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
Grid.Column="0"
Grid.ColumnSpan="3"
Background="{DynamicResource SecondaryHueMidBrush}">
<TextBlock Foreground="{DynamicResource SecondaryHueMidForegroundBrush}" Text="Accent" />
<TextBlock Foreground="{DynamicResource SecondaryHueMidForegroundBrush}" Text="Secondary" />
</Border>
</Grid>
</UserControl>
13 changes: 7 additions & 6 deletions MaterialDesign3.Demo.Wpf/PaletteSelector.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
xmlns:local="clr-namespace:MaterialDesign3Demo"
xmlns:materialDesignColors="clr-namespace:MaterialDesignColors;assembly=MaterialDesignColors"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf"
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
d:DataContext="{d:DesignInstance domain:PaletteSelectorViewModel}"
d:DesignHeight="300"
d:DesignWidth="400"
mc:Ignorable="d">
<UserControl.Resources>
<materialDesign:NullableToVisibilityConverter x:Key="NullableToVisibilityConverter" />
<DataTemplate DataType="{x:Type materialDesignColors:Swatch}">
<DataTemplate.Resources>
<Style TargetType="Button" BasedOn="{StaticResource MaterialDesignFlatButton}">
Expand Down Expand Up @@ -72,14 +73,14 @@
<Border Grid.Row="1"
Grid.Column="1"
Width="120"
Visibility="{Binding IsAccented, Converter={StaticResource BooleanToVisibilityConverter}, Mode=OneTime}">
Visibility="{Binding SecondaryExemplarHue, Converter={StaticResource NullableToVisibilityConverter}, Mode=OneTime}">
<Border.Background>
<SolidColorBrush Color="{Binding AccentExemplarHue.Color, Mode=OneTime}" />
<SolidColorBrush Color="{Binding SecondaryExemplarHue.Color, Mode=OneTime}" />
</Border.Background>

<Button Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:PaletteSelector}}, Path=DataContext.ApplyAccentCommand, Mode=OneTime}" CommandParameter="{Binding}">
<Button Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:PaletteSelector}}, Path=DataContext.ApplySecondaryCommand, Mode=OneTime}" CommandParameter="{Binding}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="Accent" />
<TextBlock Text="Secondary" />
<Viewbox Width="16" Height="16">
<Canvas Width="24" Height="24">
<Path Style="{StaticResource PalettePath}" />
Expand Down Expand Up @@ -123,4 +124,4 @@
</ItemsControl>
</Grid>
</DockPanel>
</UserControl>
</UserControl>
Loading