Skip to content
Open
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
6 changes: 6 additions & 0 deletions src/MainDemo.Wpf/Toggles.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:domain="clr-namespace:MaterialDesignDemo.Domain"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:sharedCbs="clr-namespace:MaterialDesignDemo.Shared.Examples.CheckBoxExamples;assembly=MaterialDesignDemo.Shared"
xmlns:sharedRbs="clr-namespace:MaterialDesignDemo.Shared.Examples.RadioButtonExamples;assembly=MaterialDesignDemo.Shared"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:smtx="clr-namespace:ShowMeTheXAML;assembly=ShowMeTheXAML"
d:DesignHeight="4096"
Expand Down Expand Up @@ -223,6 +225,8 @@
</smtx:XamlDisplay>
</WrapPanel>

<sharedRbs:ContentPlacementExample />

<Rectangle Style="{StaticResource PageSectionSeparator}" />
<TextBlock Style="{StaticResource PageSectionTitleTextBlock}" Text="Checkboxes" />

Expand Down Expand Up @@ -289,6 +293,8 @@
</StackPanel>
</smtx:XamlDisplay>

<sharedCbs:ContentPlacementExample />

<Rectangle Style="{StaticResource PageSectionSeparator}" />
<TextBlock Style="{StaticResource PageSectionTitleTextBlock}" Text="Switch" />

Expand Down
27 changes: 16 additions & 11 deletions src/MaterialDesign3.Demo.Wpf/Toggles.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:domain="clr-namespace:MaterialDesign3Demo.Domain"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:sharedCbs="clr-namespace:MaterialDesignDemo.Shared.Examples.CheckBoxExamples;assembly=MaterialDesignDemo.Shared"
xmlns:sharedRbs="clr-namespace:MaterialDesignDemo.Shared.Examples.RadioButtonExamples;assembly=MaterialDesignDemo.Shared"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:smtx="clr-namespace:ShowMeTheXAML;assembly=ShowMeTheXAML"
d:DesignHeight="700"
Expand Down Expand Up @@ -204,6 +206,8 @@
</smtx:XamlDisplay>
</StackPanel>

<sharedRbs:ContentPlacementExample Grid.Row="3" Grid.Column="1" />

<StackPanel Grid.Row="4"
Grid.Column="0"
Margin="0,24,0,0"
Expand Down Expand Up @@ -484,21 +488,22 @@
</StackPanel>
</smtx:XamlDisplay>

<smtx:XamlDisplay Grid.Row="8"
Grid.Column="1"
HorizontalAlignment="Left"
VerticalAlignment="Top"
UniqueKey="checkboxes_2">
<StackPanel Margin="8,0">
<CheckBox materialDesign:CheckBoxAssist.CheckBoxSize="30"
<StackPanel Grid.Row="8"
Grid.Column="1"
HorizontalAlignment="Left"
VerticalAlignment="Top">
<smtx:XamlDisplay UniqueKey="checkboxes_2">
<StackPanel Margin="8,0">
<CheckBox materialDesign:CheckBoxAssist.CheckBoxSize="30"
Content="Custom Size"
IsChecked="True" />
<CheckBox materialDesign:RippleAssist.IsDisabled="True"
<CheckBox materialDesign:RippleAssist.IsDisabled="True"
Content="Ripple disabled"
IsChecked="True" />
</StackPanel>
</smtx:XamlDisplay>

</StackPanel>
</smtx:XamlDisplay>
<sharedCbs:ContentPlacementExample />
</StackPanel>

<TextBlock Grid.Row="10"
Grid.Column="0"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<UserControl x:Class="MaterialDesignDemo.Shared.Examples.CheckBoxExamples.ContentPlacementExample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MaterialDesignDemo.Shared.Examples.CheckBoxExamples"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:smtx="clr-namespace:ShowMeTheXAML;assembly=ShowMeTheXAML"
d:DesignHeight="400"
d:DesignWidth="800"
mc:Ignorable="d">
<materialDesign:Card Padding="16" HorizontalAlignment="Left">
<StackPanel>
<TextBlock Margin="0,0,0,8"
Style="{StaticResource MaterialDesignHeadline6TextBlock}"
Text="Content placement" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="200" />
<ColumnDefinition Width="2" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>

<smtx:XamlDisplay Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
UniqueKey="CheckBox_ContentPlacementExample_1">
<CheckBox materialDesign:CheckBoxAssist.ContentPlacement="{Binding ElementName=lbContentPlacement, Path=SelectedValue}" Content="Check" />
</smtx:XamlDisplay>

<GridSplitter Grid.Column="1"
Width="2"
VerticalAlignment="Stretch" />

<StackPanel Grid.Column="2" Margin="8">
<TextBlock Text="CheckBoxAssist.ContentPlacement" />

<ListBox x:Name="lbContentPlacement"
HorizontalAlignment="Left"
SelectedIndex="3"
SelectedValuePath="Content"
Style="{StaticResource SegmentedListBox}">
<ListBoxItem Content="{x:Static Dock.Left}" />
<ListBoxItem Content="{x:Static Dock.Top}" />
<ListBoxItem Content="{x:Static Dock.Right}" />
<ListBoxItem Content="{x:Static Dock.Bottom}" />
</ListBox>
</StackPanel>
</Grid>
</StackPanel>
</materialDesign:Card>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace MaterialDesignDemo.Shared.Examples.CheckBoxExamples;

/// <summary>
/// Interaction logic for ContentPlacementExample.xaml
/// </summary>
public partial class ContentPlacementExample : UserControl
{
public ContentPlacementExample()
{
InitializeComponent();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<UserControl x:Class="MaterialDesignDemo.Shared.Examples.RadioButtonExamples.ContentPlacementExample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MaterialDesignDemo.Shared.Examples.RadioButtonExamples"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:smtx="clr-namespace:ShowMeTheXAML;assembly=ShowMeTheXAML"
d:DesignHeight="400"
d:DesignWidth="800"
mc:Ignorable="d">
<materialDesign:Card Padding="16" HorizontalAlignment="Left">
<StackPanel>
<TextBlock Margin="0,0,0,8"
Style="{StaticResource MaterialDesignHeadline6TextBlock}"
Text="Content placement" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="200" />
<ColumnDefinition Width="2" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>

<smtx:XamlDisplay Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
UniqueKey="RadioButton_ContentPlacementExample_1">
<RadioButton materialDesign:RadioButtonAssist.ContentPlacement="{Binding ElementName=lbContentPlacement, Path=SelectedValue}" Content="Radio" />
</smtx:XamlDisplay>

<GridSplitter Grid.Column="1"
Width="2"
VerticalAlignment="Stretch" />

<StackPanel Grid.Column="2" Margin="8">
<TextBlock Text="RadioButtonAssist.ContentPlacement" />

<ListBox x:Name="lbContentPlacement"
HorizontalAlignment="Left"
SelectedIndex="3"
SelectedValuePath="Content"
Style="{StaticResource SegmentedListBox}">
<ListBoxItem Content="{x:Static Dock.Left}" />
<ListBoxItem Content="{x:Static Dock.Top}" />
<ListBoxItem Content="{x:Static Dock.Right}" />
<ListBoxItem Content="{x:Static Dock.Bottom}" />
</ListBox>
</StackPanel>
</Grid>
</StackPanel>
</materialDesign:Card>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace MaterialDesignDemo.Shared.Examples.RadioButtonExamples;

/// <summary>
/// Interaction logic for ContentPlacementExample.xaml
/// </summary>
public partial class ContentPlacementExample : UserControl
{
public ContentPlacementExample()
{
InitializeComponent();
}
}
13 changes: 13 additions & 0 deletions src/MaterialDesignThemes.Wpf/CheckBoxAssist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,17 @@ public static readonly DependencyProperty CheckBoxSizeProperty
public static double GetCheckBoxSize(CheckBox element) => (double)element.GetValue(CheckBoxSizeProperty);
public static void SetCheckBoxSize(CheckBox element, double checkBoxSize) => element.SetValue(CheckBoxSizeProperty, checkBoxSize);
#endregion

#region AttachedProperty : ContentPlacementProperty
/// <summary>
/// Where the content is placed relative to the check box glyph.
/// </summary>
public static readonly DependencyProperty ContentPlacementProperty
= DependencyProperty.RegisterAttached("ContentPlacement", typeof(Dock), typeof(CheckBoxAssist), new PropertyMetadata(Dock.Right));

public static Dock GetContentPlacement(CheckBox element)
=> (Dock)element.GetValue(ContentPlacementProperty);
public static void SetContentPlacement(CheckBox element, Dock value)
=> element.SetValue(ContentPlacementProperty, value);
#endregion
}
14 changes: 14 additions & 0 deletions src/MaterialDesignThemes.Wpf/RadioButtonAssist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,19 @@ public static double GetRadioButtonSize(RadioButton element) =>
public static void SetRadioButtonSize(RadioButton element, double checkBoxSize) =>
element.SetValue(RadioButtonSizeProperty, checkBoxSize);
#endregion

#region AttachedProperty : ContentPlacementProperty
/// <summary>
/// Where the content is placed relative to the radio button glyph.
/// </summary>
public static readonly DependencyProperty ContentPlacementProperty
= DependencyProperty.RegisterAttached("ContentPlacement", typeof(Dock), typeof(RadioButtonAssist), new PropertyMetadata(Dock.Right));

public static Dock GetContentPlacement(RadioButton element)
=> (Dock)element.GetValue(ContentPlacementProperty);

public static void SetContentPlacement(RadioButton element, Dock value)
=> element.SetValue(ContentPlacementProperty, value);
#endregion
}
}
Loading
Loading