mirror of
https://gitee.com/handyorg/HandyControl.git
synced 2024-12-03 04:18:01 +08:00
add ToggleBlock
This commit is contained in:
parent
b05a1c057c
commit
4f9cc3a472
@ -23,7 +23,7 @@
|
||||
<Path Height="16" Fill="White" Stretch="Uniform" Data="{StaticResource LogoGeometry}"/>
|
||||
</Button>
|
||||
<Menu Margin="10,0,0,0" Background="Transparent">
|
||||
<MenuItem Foreground="White" Header="{x:Static langs:Lang.Repository}">
|
||||
<MenuItem Height="29" Foreground="White" Header="{x:Static langs:Lang.Repository}">
|
||||
<MenuItem Command="hc:ControlCommands.OpenLink" CommandParameter="https://github.com/NaBian/HandyControl" Header="GitHub">
|
||||
<MenuItem.Icon>
|
||||
<Path Data="{StaticResource GithubGeometry}" Fill="{DynamicResource PrimaryTextBrush}"/>
|
||||
@ -35,7 +35,7 @@
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Foreground="White" Header="{x:Static langs:Lang.About}">
|
||||
<MenuItem Height="29" Foreground="White" Header="{x:Static langs:Lang.About}">
|
||||
<MenuItem Command="{Binding OpenViewCmd}" CommandParameter="{x:Static data:MessageToken.ContributorsView}" Header="{x:Static langs:Lang.Contributors}">
|
||||
<MenuItem.Icon>
|
||||
<Path Data="{StaticResource ContributorsGeometry}" Fill="#ef6c00"/>
|
||||
@ -67,7 +67,7 @@
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Foreground="White" Header="{x:Static langs:Lang.Recommendation}">
|
||||
<MenuItem Height="29" Foreground="White" Header="{x:Static langs:Lang.Recommendation}">
|
||||
<MenuItem Header="{x:Static langs:Lang.Project}" Command="{Binding OpenViewCmd}" CommandParameter="{x:Static data:MessageToken.ProjectsView}" >
|
||||
<MenuItem.Icon>
|
||||
<Path Data="{StaticResource ProjectGeometry}" Fill="{DynamicResource PrimaryTextBrush}"/>
|
||||
|
@ -24,7 +24,7 @@
|
||||
<Path Height="16" Fill="White" Stretch="Uniform" Data="{StaticResource LogoGeometry}"/>
|
||||
</Button>
|
||||
<Menu Margin="10,0,0,0" Background="Transparent">
|
||||
<MenuItem Foreground="White" Header="{x:Static langs:Lang.Repository}">
|
||||
<MenuItem Height="29" Foreground="White" Header="{x:Static langs:Lang.Repository}">
|
||||
<MenuItem Command="hc:ControlCommands.OpenLink" CommandParameter="https://github.com/NaBian/HandyControl" Header="GitHub">
|
||||
<MenuItem.Icon>
|
||||
<Path Data="{StaticResource GithubGeometry}" Fill="{DynamicResource PrimaryTextBrush}"/>
|
||||
@ -36,7 +36,7 @@
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Foreground="White" Header="{x:Static langs:Lang.About}">
|
||||
<MenuItem Height="29" Foreground="White" Header="{x:Static langs:Lang.About}">
|
||||
<MenuItem Command="{Binding OpenViewCmd}" CommandParameter="{x:Static data:MessageToken.ContributorsView}" Header="{x:Static langs:Lang.Contributors}">
|
||||
<MenuItem.Icon>
|
||||
<Path Data="{StaticResource ContributorsGeometry}" Fill="#ef6c00"/>
|
||||
@ -68,7 +68,7 @@
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Foreground="White" Header="{x:Static langs:Lang.Recommendation}">
|
||||
<MenuItem Height="29" Foreground="White" Header="{x:Static langs:Lang.Recommendation}">
|
||||
<MenuItem Header="{x:Static langs:Lang.Project}" Command="{Binding OpenViewCmd}" CommandParameter="{x:Static data:MessageToken.ProjectsView}" >
|
||||
<MenuItem.Icon>
|
||||
<Path Data="{StaticResource ProjectGeometry}" Fill="{DynamicResource PrimaryTextBrush}"/>
|
||||
|
@ -23,7 +23,7 @@
|
||||
<Path Height="16" Fill="White" Stretch="Uniform" Data="{StaticResource LogoGeometry}"/>
|
||||
</Button>
|
||||
<Menu Margin="10,0,0,0" Background="Transparent">
|
||||
<MenuItem Foreground="White" Header="{x:Static langs:Lang.Repository}">
|
||||
<MenuItem Height="29" Foreground="White" Header="{x:Static langs:Lang.Repository}">
|
||||
<MenuItem Command="hc:ControlCommands.OpenLink" CommandParameter="https://github.com/NaBian/HandyControl" Header="GitHub">
|
||||
<MenuItem.Icon>
|
||||
<Path Data="{StaticResource GithubGeometry}" Fill="{DynamicResource PrimaryTextBrush}"/>
|
||||
@ -35,7 +35,7 @@
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Foreground="White" Header="{x:Static langs:Lang.About}">
|
||||
<MenuItem Height="29" Foreground="White" Header="{x:Static langs:Lang.About}">
|
||||
<MenuItem Command="{Binding OpenViewCmd}" CommandParameter="{x:Static data:MessageToken.ContributorsView}" Header="{x:Static langs:Lang.Contributors}">
|
||||
<MenuItem.Icon>
|
||||
<Path Data="{StaticResource ContributorsGeometry}" Fill="#ef6c00"/>
|
||||
@ -67,7 +67,7 @@
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Foreground="White" Header="{x:Static langs:Lang.Recommendation}">
|
||||
<MenuItem Height="29" Foreground="White" Header="{x:Static langs:Lang.Recommendation}">
|
||||
<MenuItem Header="{x:Static langs:Lang.Project}" Command="{Binding OpenViewCmd}" CommandParameter="{x:Static data:MessageToken.ProjectsView}" >
|
||||
<MenuItem.Icon>
|
||||
<Path Data="{StaticResource ProjectGeometry}" Fill="{DynamicResource PrimaryTextBrush}"/>
|
||||
|
@ -156,19 +156,19 @@
|
||||
<ProgressBar Style="{StaticResource ProgressBarFlat}" Margin="0,8,0,10" Value="110" Maximum="200" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border Visibility="Visible" BorderThickness="0" Padding="16" Style="{StaticResource BorderRegion}" CornerRadius="4" Canvas.Left="859" Height="264" Canvas.Top="130">
|
||||
<Border Visibility="Visible" BorderThickness="0" Padding="16" Style="{StaticResource BorderRegion}" CornerRadius="4" Canvas.Left="859" Height="262" Canvas.Top="130">
|
||||
<ScrollViewer>
|
||||
<StackPanel VerticalAlignment="Top">
|
||||
<Expander Header="Title" BorderThickness="1,1,1,0" BorderBrush="{DynamicResource BorderBrush}" Width="206" HorizontalAlignment="Left">
|
||||
<StackPanel VerticalAlignment="Top" Width="206">
|
||||
<Expander Header="Title" BorderThickness="1,1,1,0" BorderBrush="{DynamicResource BorderBrush}">
|
||||
<Border Height="100" Background="{DynamicResource SecondaryRegionBrush}"/>
|
||||
</Expander>
|
||||
<Expander Header="Title" BorderThickness="1,1,1,0" BorderBrush="{DynamicResource BorderBrush}" Width="206" HorizontalAlignment="Left">
|
||||
<Expander Header="Title" BorderThickness="1,1,1,0" BorderBrush="{DynamicResource BorderBrush}">
|
||||
<Border Height="100" Background="{DynamicResource SecondaryRegionBrush}"/>
|
||||
</Expander>
|
||||
<Expander Header="Title" BorderThickness="1,1,1,0" BorderBrush="{DynamicResource BorderBrush}" Width="206" HorizontalAlignment="Left">
|
||||
<Expander Header="Title" BorderThickness="1,1,1,0" BorderBrush="{DynamicResource BorderBrush}">
|
||||
<Border Height="100" Background="{DynamicResource SecondaryRegionBrush}"/>
|
||||
</Expander>
|
||||
<Expander Header="Title" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" Width="206" HorizontalAlignment="Left">
|
||||
<Expander Header="Title" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}">
|
||||
<Border Height="100" Background="{DynamicResource SecondaryRegionBrush}"/>
|
||||
</Expander>
|
||||
</StackPanel>
|
||||
@ -314,7 +314,7 @@
|
||||
</hc:Badge>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border Visibility="Visible" BorderThickness="0" Padding="16" Style="{StaticResource BorderRegion}" CornerRadius="4" Canvas.Left="128" Canvas.Top="310" Width="162" Height="84">
|
||||
<Border Visibility="Visible" BorderThickness="0" Padding="16" Style="{StaticResource BorderRegion}" CornerRadius="4" Canvas.Left="128" Canvas.Top="310" Width="160" Height="84">
|
||||
<WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<hc:Shield Subject="chat" Status="on gitter" Margin="0,0,0,0" Color="#4eb899" Command="hc:ControlCommands.OpenLink" CommandParameter="https://gitter.im/HandyControl/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"/>
|
||||
<hc:Shield Subject="qq" Status="714704041" Margin="0,4,0,0" Color="#d8624c" Command="hc:ControlCommands.OpenLink" CommandParameter="http://shang.qq.com/wpa/qunwpa?idkey=a571e5553c9d41e49c4f22f3a8b2865451497a795ff281fedf3285def247efc1"/>
|
||||
@ -344,7 +344,7 @@
|
||||
</hc:Transfer>
|
||||
</Border>
|
||||
<Border Visibility="Visible" BorderThickness="0" Padding="16" Style="{StaticResource BorderRegion}" CornerRadius="4" Canvas.Left="611" Canvas.Top="976">
|
||||
<userControl:CoverFlowDemoCtl Width="563" Margin="-32" Background="Transparent"/>
|
||||
<userControl:CoverFlowDemoCtl Width="559" Margin="-32" Background="Transparent"/>
|
||||
</Border>
|
||||
<Border Visibility="Visible" BorderThickness="0" Padding="16" Style="{StaticResource BorderRegion}" CornerRadius="4" Canvas.Left="1391" Canvas.Top="648" Width="274">
|
||||
<userControl:ColorPickerDemoCtl Margin="-32" Background="Transparent"/>
|
||||
|
@ -5,17 +5,17 @@
|
||||
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol">
|
||||
<hc:TransitioningContentControl>
|
||||
<StackPanel Margin="32" VerticalAlignment="Center">
|
||||
<Expander Header="{x:Static langs:Lang.Title}" BorderThickness="1,1,1,0" BorderBrush="{DynamicResource BorderBrush}" Width="240" HorizontalAlignment="Left">
|
||||
<StackPanel Margin="32" VerticalAlignment="Center" Width="240">
|
||||
<Expander Header="{x:Static langs:Lang.Title}" BorderThickness="1,1,1,0" BorderBrush="{DynamicResource BorderBrush}">
|
||||
<Border Height="100" Background="{DynamicResource SecondaryRegionBrush}"/>
|
||||
</Expander>
|
||||
<Expander Header="{x:Static langs:Lang.Title}" BorderThickness="1,1,1,0" BorderBrush="{DynamicResource BorderBrush}" Width="240" HorizontalAlignment="Left">
|
||||
<Expander Header="{x:Static langs:Lang.Title}" BorderThickness="1,1,1,0" BorderBrush="{DynamicResource BorderBrush}">
|
||||
<Border Height="100" Background="{DynamicResource SecondaryRegionBrush}"/>
|
||||
</Expander>
|
||||
<Expander Header="{x:Static langs:Lang.Title}" BorderThickness="1,1,1,0" BorderBrush="{DynamicResource BorderBrush}" Width="240" HorizontalAlignment="Left">
|
||||
<Expander Header="{x:Static langs:Lang.Title}" BorderThickness="1,1,1,0" BorderBrush="{DynamicResource BorderBrush}">
|
||||
<Border Height="100" Background="{DynamicResource SecondaryRegionBrush}"/>
|
||||
</Expander>
|
||||
<Expander Header="{x:Static langs:Lang.Title}" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" Width="240" HorizontalAlignment="Left">
|
||||
<Expander Header="{x:Static langs:Lang.Title}" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}">
|
||||
<Border Height="100" Background="{DynamicResource SecondaryRegionBrush}"/>
|
||||
</Expander>
|
||||
</StackPanel>
|
||||
|
62
src/Shared/HandyControl_Shared/Controls/Other/ToggleBlock.cs
Normal file
62
src/Shared/HandyControl_Shared/Controls/Other/ToggleBlock.cs
Normal file
@ -0,0 +1,62 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// 切换块
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 在不需要命中测试的情况下可代替ToggleButton或CheckBox,以减少内存用量。
|
||||
/// </remarks>
|
||||
public class ToggleBlock : Control
|
||||
{
|
||||
public static readonly DependencyProperty IsCheckedProperty = DependencyProperty.Register(
|
||||
"IsChecked", typeof(bool?), typeof(ToggleBlock), new FrameworkPropertyMetadata(ValueBoxes.FalseBox,
|
||||
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal));
|
||||
|
||||
[Category("Appearance")]
|
||||
[TypeConverter(typeof(NullableBoolConverter))]
|
||||
[Localizability(LocalizationCategory.None, Readability = Readability.Unreadable)]
|
||||
public bool? IsChecked
|
||||
{
|
||||
get
|
||||
{
|
||||
// Because Nullable<bool> unboxing is very slow (uses reflection) first we cast to bool
|
||||
var value = GetValue(IsCheckedProperty);
|
||||
// ReSharper disable once RedundantExplicitNullableCreation
|
||||
return value == null ? new bool?() : new bool?((bool)value);
|
||||
}
|
||||
set => SetValue(IsCheckedProperty, value.HasValue ? ValueBoxes.BooleanBox(value.Value) : null);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty CheckedContentProperty = DependencyProperty.Register(
|
||||
"CheckedContent", typeof(object), typeof(ToggleBlock), new PropertyMetadata(default(object)));
|
||||
|
||||
public object CheckedContent
|
||||
{
|
||||
get => GetValue(CheckedContentProperty);
|
||||
set => SetValue(CheckedContentProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty UnCheckedContentProperty = DependencyProperty.Register(
|
||||
"UnCheckedContent", typeof(object), typeof(ToggleBlock), new PropertyMetadata(default(object)));
|
||||
|
||||
public object UnCheckedContent
|
||||
{
|
||||
get => GetValue(UnCheckedContentProperty);
|
||||
set => SetValue(UnCheckedContentProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IndeterminateContentProperty = DependencyProperty.Register(
|
||||
"IndeterminateContent", typeof(object), typeof(ToggleBlock), new PropertyMetadata(default(object)));
|
||||
|
||||
public object IndeterminateContent
|
||||
{
|
||||
get => GetValue(IndeterminateContentProperty);
|
||||
set => SetValue(IndeterminateContentProperty, value);
|
||||
}
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Magnifier.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\ButtonGroup.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Card.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\ToggleBlock.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\RangeTrack.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\RangeThumb.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\TwoWayRangeBase.cs" />
|
||||
@ -371,6 +372,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\ToggleBlockBaseStyle.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Card.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@ -771,6 +776,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\ToggleBlock.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\ToggleButton.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
@ -21,6 +21,7 @@
|
||||
<Geometry x:Key="SearchGeometry">M716.6003 213.800623c-138.851102-138.915088-364.020238-138.915088-502.935326 0s-138.915088 364.084225 0 502.935326a355.573996 355.573996 0 0 0 502.935326 0 355.573996 355.573996 0 0 0 0-502.935326z m-580.359212 580.359212a465.183184 465.183184 0 1 1 657.783099 0 465.183184 465.183184 0 0 1-657.783099 0z m868.939152 211.156054a63.474789 63.474789 0 0 1-89.837303 0l-89.773316-89.837303a63.410803 63.410803 0 1 1 89.773316-89.773316l89.837303 89.773316a63.346816 63.346816 0 0 1 0 89.837303z</Geometry>
|
||||
<Geometry x:Key="UpDownGeometry">M454.464 143.68l-253.44 253.44c-12.032 12.032-12.032 31.36 0 43.392 11.968 11.968 31.36 11.968 43.328 0l237.376-237.376 237.376 237.376c11.968 11.968 31.36 11.968 43.328 0 12.032-12.032 12.032-31.36 0-43.392l-253.44-253.44C491.264 126.016 478.016 124.032 454.464 143.68zM507.968 947.648l252.48-253.376c11.968-11.968 11.968-31.36 0-43.392-11.968-11.968-31.296-11.968-43.264 0l-236.48 237.376L244.16 650.88c-11.968-11.968-31.296-11.968-43.264 0-11.968 12.032-11.968 31.424 0 43.392l252.48 253.376C465.984 960 491.136 964.48 507.968 947.648z</Geometry>
|
||||
<Geometry x:Key="WindowMinGeometry">M0,4 L10,4 L10,5 L0,5 z</Geometry>
|
||||
<Geometry x:Key="CheckedGeometry">M 0,2 3,5 8,0</Geometry>
|
||||
<Geometry x:Key="EyeOpenGeometry">M928 406.4c-100.8-137.6-249.6-224-416-224s-315.2 86.4-416 224c-44.8 60.8-44.8 150.4 0 211.2 102.4 137.6 251.2 224 416 224 166.4 0 315.2-86.4 416-224 46.4-60.8 46.4-150.4 0-211.2zM512 721.6c-115.2 0-209.6-94.4-209.6-209.6 0-115.2 94.4-209.6 209.6-209.6 115.2 0 209.6 94.4 209.6 209.6 1.6 115.2-92.8 209.6-209.6 209.6z m0-360c-83.2 0-150.4 67.2-150.4 150.4s67.2 150.4 150.4 150.4 150.4-67.2 150.4-150.4-67.2-150.4-150.4-150.4z m0 0</Geometry>
|
||||
<Geometry x:Key="EyeCloseGeometry">M950.4 361.6c8-20.8 0-43.2-19.2-54.4-9.6-4.8-20.8-6.4-32-3.2s-19.2 11.2-24 22.4c-56 132.8-208 228.8-361.6 228.8-155.2 0-307.2-97.6-363.2-232-4.8-11.2-12.8-19.2-24-24-9.6-4.8-20.8-3.2-32 0-20.8 9.6-30.4 35.2-20.8 56 25.6 60.8 67.2 118.4 123.2 164.8l-67.2 70.4c-14.4 16-14.4 40 0 57.6 8 8 17.6 14.4 28.8 14.4s22.4-3.2 30.4-11.2l76.8-81.6c35.2 20.8 73.6 38.4 113.6 49.6l-28.8 83.2c-8 22.4 3.2 46.4 24 54.4 4.8 1.6 9.6 3.2 14.4 3.2 6.4 0 11.2-1.6 17.6-3.2 9.6-4.8 17.6-12.8 22.4-24l33.6-96c41.6 4.8 81.6 3.2 123.2-3.2l32 94.4c3.2 11.2 11.2 19.2 22.4 24 9.6 4.8 20.8 4.8 32 1.6 20.8-8 32-32 24-54.4l-28.8-84.8c30.4-9.6 59.2-22.4 86.4-38.4l62.4 65.6c14.4 16 43.2 16 57.6 0 16-16 16-43.2 0-60.8l-51.2-54.4c56-43.2 100.8-100.8 128-164.8z</Geometry>
|
||||
<Geometry x:Key="WindowRestoreGeometry">M1,3 L1,9 L7,9 L7,3 z M3,1 L3,2 L8,2 L8,7 L9,7 L9,1 z M2,0 L10,0 L10,8 L8,8 L8,10 L0,10 L0,2 L2,2 z</Geometry>
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="BaseStyle.xaml"/>
|
||||
<ResourceDictionary Source="../../Basic/Geometries.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style x:Key="CheckBoxBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="CheckBox">
|
||||
@ -49,7 +50,7 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Height="18" Width="18" x:Name="checkBoxBorder" Background="{TemplateBinding Background}" CornerRadius="2" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"/>
|
||||
<controls:SimplePanel Grid.Column="0" Height="18" Width="18" x:Name="markGrid">
|
||||
<Path UseLayoutRounding="True" x:Name="path" StrokeDashOffset="8" StrokeDashArray="8,8" Width="12" Height="12" Data="M 0,2 3,5 8,0" StrokeThickness="2" Stretch="Uniform" Stroke="White"/>
|
||||
<Path UseLayoutRounding="True" x:Name="path" StrokeDashOffset="8" StrokeDashArray="8,8" Width="12" Height="12" Data="{StaticResource CheckedGeometry}" StrokeThickness="2" Stretch="Uniform" Stroke="{DynamicResource TextIconBrush}"/>
|
||||
<Rectangle x:Name="indeterminateMark" RadiusX="2" RadiusY="2" Fill="{DynamicResource PrimaryBrush}" Margin="2" Opacity="0"/>
|
||||
</controls:SimplePanel>
|
||||
<ContentPresenter x:Name="contentPresenter" Visibility="Collapsed" Grid.Column="1" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
|
@ -1,17 +1,17 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../Basic/Geometries.xaml"/>
|
||||
<ResourceDictionary Source="../ToggleButton.xaml"/>
|
||||
<ResourceDictionary Source="../ToggleBlock.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style x:Key="ExpanderBaseStyle" TargetType="Expander">
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/>
|
||||
<Setter Property="Background" Value="{DynamicResource TitleBrush}"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="MinHeight" Value="32"/>
|
||||
@ -24,17 +24,15 @@
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<ToggleButton Focusable="False" Padding="10,0,0,0" Foreground="{TemplateBinding Foreground}" Grid.ColumnSpan="2" HorizontalContentAlignment="Stretch" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Width="{TemplateBinding Width}" Height="{TemplateBinding MinHeight}" Style="{StaticResource ToggleButtonCustom}">
|
||||
<ToggleButton.Content>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="{TemplateBinding MinHeight}"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter ContentSource="Header"/>
|
||||
<ToggleButton Foreground="{TemplateBinding Foreground}" Grid.Column="1" Padding="0" Margin="0,0,10,0" Width="12" Height="12" VerticalAlignment="Center" HorizontalAlignment="Right" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" controls:IconSwitchElement.Geometry="{StaticResource DownGeometry}" controls:IconSwitchElement.GeometrySelected="{StaticResource UpGeometry}" Style="{StaticResource ToggleButtonIconTransparent}"/>
|
||||
</Grid>
|
||||
</ToggleButton.Content>
|
||||
<ToggleButton HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" Focusable="False" Padding="10,0,0,0" Foreground="{TemplateBinding Foreground}" Grid.ColumnSpan="2" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Width="{TemplateBinding Width}" Height="{TemplateBinding MinHeight}" Style="{StaticResource ToggleButtonCustom}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="32"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter ContentSource="Header" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
<Path Name="PathArrow" IsHitTestVisible="False" Grid.Column="1" Fill="{TemplateBinding Foreground}" Data="{StaticResource DownGeometry}" Margin="0,0,10,0" Width="12" Height="12" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="Right"/>
|
||||
</Grid>
|
||||
</ToggleButton>
|
||||
<ContentPresenter Name="ExpandSite" Visibility="Collapsed" Grid.Row="1" Grid.Column="0"/>
|
||||
</Grid>
|
||||
@ -42,6 +40,7 @@
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsExpanded" Value="true">
|
||||
<Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
|
||||
<Setter Property="Data" TargetName="PathArrow" Value="{StaticResource UpGeometry}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Opacity" Value="2"/>
|
||||
|
@ -8,18 +8,18 @@
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style x:Key="MenuItemBaseStyle" TargetType="MenuItem">
|
||||
<Setter Property="Padding" Value="{StaticResource DefaultControlPadding}"/>
|
||||
<Setter Property="OverridesDefaultStyle" Value="True"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="MinHeight" Value="32"/>
|
||||
<Setter Property="controls:ScrollViewer.PanningMode" Value="Both"/>
|
||||
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="MenuItem">
|
||||
<Border x:Name="Bd" MinWidth="240" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Uid="Border_38">
|
||||
<Grid x:Name="Grid" Uid="Grid_49">
|
||||
<Border x:Name="Bd" MinWidth="240" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
|
||||
<Grid x:Name="Grid" Margin="{TemplateBinding Padding}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="26"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
@ -27,12 +27,12 @@
|
||||
<ColumnDefinition SharedSizeGroup="MenuItemIGTColumnGroup" Width="Auto"/>
|
||||
<ColumnDefinition Width="20"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter x:Name="Icon" Content="{TemplateBinding Icon}" ContentSource="Icon" HorizontalAlignment="Right" Height="16" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" Width="16"/>
|
||||
<Border Grid.Column="0" x:Name="GlyphPanel" CornerRadius="2" Background="{DynamicResource PrimaryBrush}" ClipToBounds="False" HorizontalAlignment="Right" Height="16" Visibility="Hidden" VerticalAlignment="Center" Width="16">
|
||||
<Path x:Name="Glyph" Margin="2" Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Center" Data="F1 M 9.97498,1.22334L 4.6983,9.09834L 4.52164,9.09834L 0,5.19331L 1.27664,3.52165L 4.255,6.08833L 8.33331,1.52588e-005L 9.97498,1.22334 Z " Fill="White" FlowDirection="LeftToRight"/>
|
||||
<ContentPresenter Margin="0,0,10,0" x:Name="Icon" ContentSource="Icon" HorizontalAlignment="Right" Height="16" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" Width="16"/>
|
||||
<Border Margin="0,0,10,0" IsHitTestVisible="False" Grid.Column="0" x:Name="GlyphPanel" CornerRadius="2" Background="{DynamicResource PrimaryBrush}" ClipToBounds="False" HorizontalAlignment="Right" Height="16" Visibility="Hidden" VerticalAlignment="Center" Width="16">
|
||||
<Path UseLayoutRounding="True" Width="12" Height="12" Data="{StaticResource CheckedGeometry}" StrokeThickness="2" Stretch="Uniform" Stroke="{DynamicResource TextIconBrush}"/>
|
||||
</Border>
|
||||
<ContentPresenter Grid.Column="1" x:Name="ContentPresenter" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" ContentSource="Header" Margin="10" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Uid="ContentPresenter_33"/>
|
||||
<TextBlock x:Name="InputGestureText" Margin="0,0,10,0" Grid.Column="3" VerticalAlignment="Center" HorizontalAlignment="Left" Text="{TemplateBinding InputGestureText}" Uid="TextBlock_10"/>
|
||||
<ContentPresenter Grid.Column="1" x:Name="ContentPresenter" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentSource="Header" Margin="0,3" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
<TextBlock x:Name="InputGestureText" Margin="0,0,10,0" Grid.Column="3" VerticalAlignment="Center" HorizontalAlignment="Left" Text="{TemplateBinding InputGestureText}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
@ -49,21 +49,20 @@
|
||||
<Style.Triggers>
|
||||
<Trigger Property="Role" Value="TopLevelHeader">
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
<Setter Property="Padding" Value="10,0"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="MenuItem">
|
||||
<Border MinWidth="44" Height="{TemplateBinding Height}" x:Name="templateRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,1,0" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
|
||||
<Grid VerticalAlignment="Center">
|
||||
<Border MinWidth="44" x:Name="templateRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,1,0" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
|
||||
<Grid VerticalAlignment="Center" Margin="{TemplateBinding Padding}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter x:Name="Icon" Visibility="Collapsed" Content="{TemplateBinding Icon}" ContentSource="Icon" HorizontalAlignment="Right" Height="16" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" Width="16"/>
|
||||
<Border Grid.Column="0" x:Name="GlyphPanel" CornerRadius="2" Background="{DynamicResource PrimaryBrush}" ClipToBounds="False" HorizontalAlignment="Right" Height="16" Visibility="Collapsed" VerticalAlignment="Center" Width="16">
|
||||
<Path x:Name="Glyph" Margin="2" Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Center" Data="F1 M 9.97498,1.22334L 4.6983,9.09834L 4.52164,9.09834L 0,5.19331L 1.27664,3.52165L 4.255,6.08833L 8.33331,1.52588e-005L 9.97498,1.22334 Z " Fill="White" FlowDirection="LeftToRight"/>
|
||||
<ContentPresenter Margin="0,0,10,0" x:Name="Icon" Visibility="Collapsed" ContentSource="Icon" HorizontalAlignment="Right" Height="16" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" Width="16"/>
|
||||
<Border Margin="0,0,10,0" Grid.Column="0" x:Name="GlyphPanel" CornerRadius="2" Background="{DynamicResource PrimaryBrush}" ClipToBounds="False" HorizontalAlignment="Right" Height="16" Visibility="Collapsed" VerticalAlignment="Center" Width="16">
|
||||
<Path UseLayoutRounding="True" Width="12" Height="12" Data="{StaticResource CheckedGeometry}" StrokeThickness="2" Stretch="Uniform" Stroke="{DynamicResource TextIconBrush}"/>
|
||||
</Border>
|
||||
<ContentPresenter x:Name="menuHeaderContainer" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Grid.Column="1" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
<ContentPresenter x:Name="menuHeaderContainer" ContentTemplate="{TemplateBinding HeaderTemplate}" Grid.Column="1" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
<Popup Grid.Column="0" x:Name="PART_Popup" PlacementTarget="{Binding ElementName=templateRoot}" AllowsTransparency="True" Focusable="False" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom">
|
||||
<controls:SimplePanel>
|
||||
<Border CornerRadius="0,0,2,2" x:Name="SubMenuBorder" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}">
|
||||
@ -100,21 +99,20 @@
|
||||
</Trigger>
|
||||
<Trigger Property="Role" Value="TopLevelItem">
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
<Setter Property="Padding" Value="10,0"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="MenuItem">
|
||||
<Border Padding="{TemplateBinding Padding}" x:Name="templateRoot" Height="{TemplateBinding Height}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,1,0" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
|
||||
<Grid>
|
||||
<Border x:Name="templateRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,1,0" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
|
||||
<Grid Margin="{TemplateBinding Padding}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter x:Name="Icon" Visibility="Collapsed" HorizontalAlignment="Left" Content="{TemplateBinding Icon}" ContentSource="Icon" Height="16" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" Width="16"/>
|
||||
<Border Grid.Column="0" x:Name="GlyphPanel" CornerRadius="2" Background="{DynamicResource PrimaryBrush}" ClipToBounds="False" HorizontalAlignment="Right" Height="16" Visibility="Collapsed" VerticalAlignment="Center" Width="16">
|
||||
<Path x:Name="Glyph" Margin="2" Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Center" Data="F1 M 9.97498,1.22334L 4.6983,9.09834L 4.52164,9.09834L 0,5.19331L 1.27664,3.52165L 4.255,6.08833L 8.33331,1.52588e-005L 9.97498,1.22334 Z " Fill="White" FlowDirection="LeftToRight"/>
|
||||
<ContentPresenter Margin="0,0,10,0" x:Name="Icon" Visibility="Collapsed" HorizontalAlignment="Left" ContentSource="Icon" Height="16" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" Width="16"/>
|
||||
<Border Margin="0,0,10,0" IsHitTestVisible="False" Grid.Column="0" x:Name="GlyphPanel" CornerRadius="2" Background="{DynamicResource PrimaryBrush}" ClipToBounds="False" HorizontalAlignment="Right" Height="16" Visibility="Collapsed" VerticalAlignment="Center" Width="16">
|
||||
<Path UseLayoutRounding="True" Width="12" Height="12" Data="{StaticResource CheckedGeometry}" StrokeThickness="2" Stretch="Uniform" Stroke="{DynamicResource TextIconBrush}"/>
|
||||
</Border>
|
||||
<ContentPresenter x:Name="menuHeaderContainer" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Grid.Column="1" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" HorizontalAlignment="Left" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
|
||||
<ContentPresenter x:Name="menuHeaderContainer" ContentTemplate="{TemplateBinding HeaderTemplate}" Grid.Column="1" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" HorizontalAlignment="Left" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
@ -148,13 +146,12 @@
|
||||
</Trigger>
|
||||
<Trigger Property="Role" Value="SubmenuHeader">
|
||||
<Setter Property="DockPanel.Dock" Value="Top"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="MenuItem">
|
||||
<Border x:Name="Bd" MinWidth="240" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Uid="Border_42">
|
||||
<Grid x:Name="Grid" Uid="Grid_50">
|
||||
<Border x:Name="Bd" MinWidth="240" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
|
||||
<Grid x:Name="Grid" Margin="{TemplateBinding Padding}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="26"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
@ -162,13 +159,13 @@
|
||||
<ColumnDefinition SharedSizeGroup="MenuItemIGTColumnGroup" Width="Auto"/>
|
||||
<ColumnDefinition Width="20"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter x:Name="Icon" Content="{TemplateBinding Icon}" ContentSource="Icon" HorizontalAlignment="Right" Height="16" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" Width="16"/>
|
||||
<Border Grid.Column="0" x:Name="GlyphPanel" CornerRadius="2" Background="{DynamicResource PrimaryBrush}" ClipToBounds="False" HorizontalAlignment="Right" Height="16" Visibility="Hidden" VerticalAlignment="Center" Width="16">
|
||||
<Path x:Name="Glyph" Margin="2" Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Center" Data="F1 M 9.97498,1.22334L 4.6983,9.09834L 4.52164,9.09834L 0,5.19331L 1.27664,3.52165L 4.255,6.08833L 8.33331,1.52588e-005L 9.97498,1.22334 Z " Fill="White" FlowDirection="LeftToRight"/>
|
||||
<ContentPresenter Margin="0,0,10,0" x:Name="Icon" ContentSource="Icon" HorizontalAlignment="Right" Height="16" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" Width="16"/>
|
||||
<Border Margin="0,0,10,0" IsHitTestVisible="False" Grid.Column="0" x:Name="GlyphPanel" CornerRadius="2" Background="{DynamicResource PrimaryBrush}" ClipToBounds="False" HorizontalAlignment="Right" Height="16" Visibility="Hidden" VerticalAlignment="Center" Width="16">
|
||||
<Path UseLayoutRounding="True" Width="12" Height="12" Data="{StaticResource CheckedGeometry}" StrokeThickness="2" Stretch="Uniform" Stroke="{DynamicResource TextIconBrush}"/>
|
||||
</Border>
|
||||
<ContentPresenter TextElement.Foreground="{TemplateBinding Foreground}" x:Name="ContentPresenter" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Grid.Column="1" ContentSource="Header" Margin="10" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Uid="ContentPresenter_39"/>
|
||||
<Path x:Name="Path" Grid.Column="4" Width="10" Height="10" HorizontalAlignment="Left" Data="{StaticResource RightGeometry}" Stretch="Uniform" Fill="{TemplateBinding Foreground}" Uid="Path_16" VerticalAlignment="Center"/>
|
||||
<Popup Grid.Column="1" x:Name="PART_Popup" AllowsTransparency="True" Focusable="False" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" VerticalOffset="-7">
|
||||
<ContentPresenter TextElement.Foreground="{TemplateBinding Foreground}" Margin="0,3" x:Name="ContentPresenter" ContentTemplate="{TemplateBinding HeaderTemplate}" Grid.Column="1" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
<Path x:Name="Path" Grid.Column="4" Width="10" Height="10" HorizontalAlignment="Left" Data="{StaticResource RightGeometry}" Stretch="Uniform" Fill="{TemplateBinding Foreground}" VerticalAlignment="Center"/>
|
||||
<Popup Grid.Column="1" x:Name="PART_Popup" AllowsTransparency="True" Focusable="False" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" VerticalOffset="-13" HorizontalOffset="10">
|
||||
<Border CornerRadius="2" x:Name="SubMenuBorder" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}">
|
||||
<ScrollViewer Style="{StaticResource ScrollViewerUpDown}" Margin="0,6">
|
||||
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Cycle" Grid.IsSharedSizeScope="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.TabNavigation="Cycle"/>
|
||||
|
@ -0,0 +1,35 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||
|
||||
<Style x:Key="ToggleBlockBaseStyle" TargetType="controls:ToggleBlock">
|
||||
<Setter Property="IsHitTestVisible" Value="False"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:ToggleBlock">
|
||||
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<controls:SimplePanel Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
|
||||
<ContentPresenter Name="ContentPresenterChecked" ContentSource="CheckedContent" Visibility="Collapsed"/>
|
||||
<ContentPresenter Name="ContentPresenterUnChecked" ContentSource="UnCheckedContent"/>
|
||||
<ContentPresenter Name="ContentPresenterIndeterminate" ContentSource="IndeterminateContent" Visibility="Collapsed"/>
|
||||
</controls:SimplePanel>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter TargetName="ContentPresenterChecked" Property="Visibility" Value="Visible"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="False">
|
||||
<Setter TargetName="ContentPresenterUnChecked" Property="Visibility" Value="Visible"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="{x:Null}">
|
||||
<Setter TargetName="ContentPresenterIndeterminate" Property="Visibility" Value="Visible"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
@ -69,6 +69,7 @@
|
||||
<ResourceDictionary Source="Card.xaml"/>
|
||||
<ResourceDictionary Source="Rectangle.xaml"/>
|
||||
<ResourceDictionary Source="Magnifier.xaml"/>
|
||||
<ResourceDictionary Source="ToggleBlock.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
</ResourceDictionary>
|
@ -0,0 +1,28 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Base/ToggleBlockBaseStyle.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style BasedOn="{StaticResource ToggleBlockBaseStyle}" TargetType="controls:ToggleBlock"/>
|
||||
|
||||
<Style x:Key="ToggleBlockIcon" BasedOn="{StaticResource ToggleBlockBaseStyle}" TargetType="controls:ToggleBlock">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:ToggleBlock">
|
||||
<ContentControl Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
|
||||
<Path x:Name="PathIcon" Width="{TemplateBinding controls:IconElement.Width}" Height="{TemplateBinding controls:IconElement.Height}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding controls:IconSwitchElement.Geometry}"/>
|
||||
</ContentControl>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter TargetName="PathIcon" Property="Data" Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(controls:IconSwitchElement.GeometrySelected)}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
Loading…
Reference in New Issue
Block a user