You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
131 lines
6.3 KiB
131 lines
6.3 KiB
<!--*************************************************************************************
|
|
|
|
Toolkit for WPF
|
|
|
|
Copyright (C) 2007-2025 Xceed Software Inc.
|
|
|
|
This program is provided to you under the terms of the XCEED SOFTWARE, INC.
|
|
COMMUNITY LICENSE AGREEMENT (for non-commercial use) as published at
|
|
https://github.com/xceedsoftware/wpftoolkit/blob/master/license.md
|
|
|
|
For more features, controls, and fast professional support,
|
|
pick up the Plus Edition at https://xceed.com/xceed-toolkit-plus-for-wpf/
|
|
|
|
Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
|
|
|
|
***********************************************************************************-->
|
|
<local:MaterialDemoView x:Class="Xceed.Wpf.Toolkit.LiveExplorer.Samples.MaterialControls.Views.MaterialSwitchView"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:local="clr-namespace:Xceed.Wpf.Toolkit.LiveExplorer"
|
|
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
|
Title="MaterialSwitch">
|
|
<local:DemoView.Description>
|
|
<Paragraph FontSize="14"
|
|
FontFamily="Segoe">
|
|
<Run>A ToggleSwitch from the Xceed WPF Toolkit with thumb animations when Checked state is changed and that is using the Material Brushes.</Run>
|
|
<!--##INCLUDE_OPEN_SOURCE
|
|
<LineBreak />
|
|
<LineBreak />
|
|
<Run>This feature is only available in the "Plus" version.</Run>
|
|
<LineBreak />
|
|
<Hyperlink NavigateUri="https://xceed.com/xceed-toolkit-plus-for-wpf" RequestNavigate="Hyperlink_RequestNavigate">
|
|
Click here for more details about Xceed Toolkit Plus for WPF.
|
|
</Hyperlink>
|
|
##END-->
|
|
</Paragraph>
|
|
</local:DemoView.Description>
|
|
|
|
<!--##EXCLUDE_OPEN_SOURCE-->
|
|
<local:DemoView.Resources>
|
|
<ResourceDictionary>
|
|
<ResourceDictionary.MergedDictionaries>
|
|
<ResourceDictionary Source="../Resources/CommonResources.xaml" />
|
|
</ResourceDictionary.MergedDictionaries>
|
|
|
|
<Path x:Key="UnPinPath"
|
|
Data="M537.76,0L767,237.883 699.552,307.874 654.177,260.828 449.89,472.781 460.135,483.414 447.983,639.291 336.562,523.67 0,767 265.122,449.537 154.528,334.849 304.815,322.276 311.431,329.066 336,303.562 336,300 339.432,300 515.648,117.076 470.311,69.9921z"
|
|
Stretch="Uniform"
|
|
Margin="6"
|
|
Fill="White" />
|
|
|
|
<Path x:Key="PinPath"
|
|
Data="M537.76,0L767,237.883 699.552,307.874 654.177,260.828 449.89,472.781 460.135,483.414 447.983,639.291 336.562,523.67 0,767 265.122,449.537 154.528,334.849 304.815,322.276 311.431,329.066 336,303.562 336,300 339.432,300 515.648,117.076 470.311,69.9921z"
|
|
Stretch="Uniform"
|
|
Margin="6"
|
|
Fill="White"
|
|
RenderTransformOrigin="0.5,0.5">
|
|
<Path.RenderTransform>
|
|
<RotateTransform Angle="-45" />
|
|
</Path.RenderTransform>
|
|
</Path>
|
|
</ResourceDictionary>
|
|
</local:DemoView.Resources>
|
|
|
|
<Grid>
|
|
<StackPanel Margin="10">
|
|
|
|
<GroupBox Header="Features"
|
|
Margin="0,5,0,5">
|
|
<Grid Margin="5">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="95" />
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="95" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<!-- First Column-->
|
|
<TextBlock Grid.Column="0"
|
|
Grid.Row="0"
|
|
Text="Material Accent Brush: "
|
|
VerticalAlignment="Center" />
|
|
<ComboBox Grid.Column="1"
|
|
Grid.Row="0"
|
|
ItemsSource="{Binding MaterialBrushes, RelativeSource={RelativeSource AncestorType={x:Type local:MaterialDemoView}}}"
|
|
SelectedItem="{Binding MaterialAccentBrush, ElementName=materialSwitch}"
|
|
ItemTemplate="{StaticResource ColorItemTemplate}"
|
|
VerticalAlignment="Center"
|
|
Margin="5" />
|
|
|
|
<!-- Second Column-->
|
|
<TextBlock Grid.Column="2"
|
|
Grid.Row="0"
|
|
Text="Thumb Checked Background: "
|
|
VerticalAlignment="Center"
|
|
Margin="10,0,0,0"/>
|
|
<ComboBox Grid.Column="3"
|
|
Grid.Row="0"
|
|
ItemsSource="{Binding MaterialBrushes, RelativeSource={RelativeSource AncestorType={x:Type local:MaterialDemoView}}}"
|
|
SelectedItem="{Binding ThumbCheckedBackground, ElementName=materialSwitch}"
|
|
ItemTemplate="{StaticResource ColorItemTemplate}"
|
|
ToolTip="Background used when MaterialSwitch is checked. ThumbBackground property will be used when unchecked."
|
|
Margin="5"/>
|
|
</Grid>
|
|
</GroupBox>
|
|
|
|
<StackPanel>
|
|
<TextBlock Text="Usage:"
|
|
Style="{StaticResource Header}" />
|
|
|
|
<xctk:MaterialSwitch x:Name="materialSwitch"
|
|
Margin="20"
|
|
HorizontalAlignment="Center"
|
|
Width="60"
|
|
MinHeight="18"
|
|
ThumbBackground="Gray"
|
|
ThumbLeftContent="{StaticResource UnPinPath}"
|
|
ThumbRightContent="{StaticResource PinPath}"/>
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</Grid>
|
|
<!--##END-->
|
|
|
|
<!--##INCLUDE_OPEN_SOURCE
|
|
<Image Source="..\OpenSourceImages\MaterialSwitch.png" Width="600" Height="400"/>
|
|
##END-->
|
|
</local:MaterialDemoView>
|
|
|