47 files changed
+530
-208
No files matched your search
@@ -5,10 +5,12 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
<AssemblyName>HandyControlDemo</AssemblyName>
|
||||
<RootNamespace>HandyControlDemo</RootNamespace>
|
||||
<Version>1.5.5</Version>
|
||||
<Version>2.0.0</Version>
|
||||
<ApplicationIcon>..\..\Shared\HandyControlDemo_Shared\Resources\Img\icon.ico</ApplicationIcon>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<Copyright>Copyright © HandyOrg 2018-2019</Copyright>
|
||||
<FileVersion>2.0.0.0</FileVersion>
|
||||
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DefineConstants>TRACE;Core</DefineConstants>
|
||||
@@ -350,6 +352,9 @@
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\brackets_Square_16xLG.png">
|
||||
<Link>Resources\Img\LeftMainContent\brackets_Square_16xLG.png</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\ButtonGroup_16x.png">
|
||||
<Link>Resources\Img\LeftMainContent\ButtonGroup_16x.png</Link>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\Lang.en.resx">
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
<AssemblyName>HandyControl</AssemblyName>
|
||||
<RootNamespace>HandyControl</RootNamespace>
|
||||
<Version>1.5.5</Version>
|
||||
<AssemblyVersion>1.5.5.0</AssemblyVersion>
|
||||
<Version>2.0.0</Version>
|
||||
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
||||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
||||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
||||
<Copyright>Copyright © HandyOrg 2018-2019</Copyright>
|
||||
|
||||
@@ -395,6 +395,9 @@
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>MessageToken.cs</LastGenOutput>
|
||||
</Content>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\ButtonGroup_16x.png">
|
||||
<Link>Resources\Img\LeftMainContent\ButtonGroup_16x.png</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\brackets_Square_16xLG.png">
|
||||
<Link>Resources\Img\LeftMainContent\brackets_Square_16xLG.png</Link>
|
||||
</Resource>
|
||||
|
||||
@@ -457,6 +457,9 @@
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>MessageToken.cs</LastGenOutput>
|
||||
</Content>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\ButtonGroup_16x.png">
|
||||
<Link>Resources\Img\LeftMainContent\ButtonGroup_16x.png</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\brackets_Square_16xLG.png">
|
||||
<Link>Resources\Img\LeftMainContent\brackets_Square_16xLG.png</Link>
|
||||
</Resource>
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release-Net45|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<OutputPath>bin\Release\Net45\</OutputPath>
|
||||
<DefineConstants>TRACE;netle45</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
@@ -73,7 +73,7 @@
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release-Net462|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<OutputPath>bin\Release\Net462\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
@@ -84,7 +84,7 @@
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release-Net47|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<OutputPath>bin\Release\Net47\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
@@ -95,7 +95,7 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release-Net48|AnyCPU'">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<OutputPath>bin\Release\Net48\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
|
||||
@@ -98,6 +98,8 @@
|
||||
|
||||
public static readonly string RangeSliderDemoCtl = nameof(RangeSliderDemoCtl);
|
||||
|
||||
public static readonly string ButtonGroupDemoCtl = nameof(ButtonGroupDemoCtl);
|
||||
|
||||
public static readonly string ButtonDemoCtl = nameof(ButtonDemoCtl);
|
||||
|
||||
public static readonly string RepeatButtonDemoCtl = nameof(RepeatButtonDemoCtl);
|
||||
|
||||
@@ -51,7 +51,8 @@ var controlList = new List<string>
|
||||
"DialogDemoCtl",
|
||||
"SideMenuDemoCtl",
|
||||
"GridDemoCtl",
|
||||
"RangeSliderDemoCtl"
|
||||
"RangeSliderDemoCtl",
|
||||
"ButtonGroupDemoCtl"
|
||||
};
|
||||
var styleList = new List<string>
|
||||
{
|
||||
|
||||
@@ -56,6 +56,9 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\BadgeDemoCtl.xaml.cs">
|
||||
<DependentUpon>BadgeDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\ButtonGroupDemoCtl.xaml.cs">
|
||||
<DependentUpon>ButtonGroupDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\CalendarWithClockDemoCtl.xaml.cs">
|
||||
<DependentUpon>CalendarWithClockDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -413,6 +416,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\ButtonGroupDemoCtl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\CalendarWithClockDemoCtl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -13,5 +13,5 @@ using System.Windows;
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
|
||||
[assembly: AssemblyVersion("1.5.5")]
|
||||
[assembly: AssemblyVersion("2.0.0")]
|
||||
#endif
|
||||
@@ -177,6 +177,15 @@ namespace HandyControlDemo.Properties.Langs {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 按钮组 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string ButtonGroup {
|
||||
get {
|
||||
return ResourceManager.GetString("ButtonGroup", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 日历 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -618,4 +618,7 @@
|
||||
<data name="Off" xml:space="preserve">
|
||||
<value>Off</value>
|
||||
</data>
|
||||
<data name="ButtonGroup" xml:space="preserve">
|
||||
<value>ButtonGroup</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -618,4 +618,7 @@
|
||||
<data name="Off" xml:space="preserve">
|
||||
<value>关</value>
|
||||
</data>
|
||||
<data name="ButtonGroup" xml:space="preserve">
|
||||
<value>按钮组</value>
|
||||
</data>
|
||||
</root>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 194 B |
@@ -0,0 +1,71 @@
|
||||
<UserControl x:Class="HandyControlDemo.UserControl.ButtonGroupDemoCtl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Background="{DynamicResource RegionBrush}"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs">
|
||||
<hc:TransitioningContentControl>
|
||||
<WrapPanel Margin="16" VerticalAlignment="Center">
|
||||
<StackPanel Margin="16">
|
||||
<hc:ButtonGroup>
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}" IsChecked="True"/>
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
</hc:ButtonGroup>
|
||||
<hc:ButtonGroup Margin="0,32,0,0">
|
||||
<Button Content="{x:Static langs:Lang.Button}"/>
|
||||
<Button Content="{x:Static langs:Lang.Button}"/>
|
||||
<Button Content="{x:Static langs:Lang.Button}"/>
|
||||
<Button Content="{x:Static langs:Lang.Button}"/>
|
||||
<Button Content="{x:Static langs:Lang.Button}"/>
|
||||
</hc:ButtonGroup>
|
||||
<hc:ButtonGroup Margin="0,32,0,0" Style="{StaticResource ButtonGroupSolid}">
|
||||
<ToggleButton Content="{x:Static langs:Lang.ToggleButton}"/>
|
||||
<ToggleButton Content="{x:Static langs:Lang.ToggleButton}"/>
|
||||
<ToggleButton Content="{x:Static langs:Lang.ToggleButton}" IsChecked="True"/>
|
||||
<ToggleButton Content="{x:Static langs:Lang.ToggleButton}"/>
|
||||
<ToggleButton Content="{x:Static langs:Lang.ToggleButton}"/>
|
||||
</hc:ButtonGroup>
|
||||
<hc:ButtonGroup Margin="0,32,0,0">
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}" IsChecked="True"/>
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
<Button Content="{x:Static langs:Lang.Button}"/>
|
||||
<ToggleButton Content="{x:Static langs:Lang.ToggleButton}"/>
|
||||
<ToggleButton Content="{x:Static langs:Lang.ToggleButton}" IsChecked="True"/>
|
||||
</hc:ButtonGroup>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="16" Orientation="Horizontal">
|
||||
<hc:ButtonGroup Orientation="Vertical">
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}" IsChecked="True"/>
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
</hc:ButtonGroup>
|
||||
<hc:ButtonGroup Margin="32,0,0,0" Orientation="Vertical">
|
||||
<Button Content="{x:Static langs:Lang.Button}"/>
|
||||
<Button Content="{x:Static langs:Lang.Button}"/>
|
||||
<Button Content="{x:Static langs:Lang.Button}"/>
|
||||
<Button Content="{x:Static langs:Lang.Button}"/>
|
||||
<Button Content="{x:Static langs:Lang.Button}"/>
|
||||
</hc:ButtonGroup>
|
||||
<hc:ButtonGroup Margin="32,0,0,0" Style="{StaticResource ButtonGroupSolid}" Orientation="Vertical">
|
||||
<ToggleButton Content="{x:Static langs:Lang.ToggleButton}"/>
|
||||
<ToggleButton Content="{x:Static langs:Lang.ToggleButton}"/>
|
||||
<ToggleButton Content="{x:Static langs:Lang.ToggleButton}" IsChecked="True"/>
|
||||
<ToggleButton Content="{x:Static langs:Lang.ToggleButton}"/>
|
||||
<ToggleButton Content="{x:Static langs:Lang.ToggleButton}"/>
|
||||
</hc:ButtonGroup>
|
||||
<hc:ButtonGroup Margin="32,0,0,0" Orientation="Vertical">
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}" IsChecked="True"/>
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
<Button Content="{x:Static langs:Lang.Button}"/>
|
||||
<ToggleButton Content="{x:Static langs:Lang.ToggleButton}"/>
|
||||
<ToggleButton Content="{x:Static langs:Lang.ToggleButton}" IsChecked="True"/>
|
||||
</hc:ButtonGroup>
|
||||
</StackPanel>
|
||||
</WrapPanel>
|
||||
</hc:TransitioningContentControl>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,40 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class ButtonGroupDemoCtl
|
||||
{
|
||||
public ButtonGroupDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SourceProperty = DependencyProperty.Register(
|
||||
"Source", typeof(BitmapFrame), typeof(Avatar), new PropertyMetadata(default(BitmapFrame)));
|
||||
|
||||
public BitmapFrame Source
|
||||
{
|
||||
get => (BitmapFrame) GetValue(SourceProperty);
|
||||
set => SetValue(SourceProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty UserNameProperty = DependencyProperty.Register(
|
||||
"DisplayName", typeof(string), typeof(Avatar), new PropertyMetadata(default(string)));
|
||||
|
||||
public string DisplayName
|
||||
{
|
||||
get => (string) GetValue(UserNameProperty);
|
||||
set => SetValue(UserNameProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty LinkProperty = DependencyProperty.Register(
|
||||
"Link", typeof(string), typeof(Avatar), new PropertyMetadata(default(string)));
|
||||
|
||||
public string Link
|
||||
{
|
||||
get => (string) GetValue(LinkProperty);
|
||||
set => SetValue(LinkProperty, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -210,6 +210,11 @@
|
||||
<Image Source="../../Resources/Img/LeftMainContent/GoToTop_16x.png"/>
|
||||
</hc:EdgeElement.LeftContent>
|
||||
</ListBoxItem>
|
||||
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.ButtonGroupDemoCtl}" Content="{x:Static langs:Lang.ButtonGroup}">
|
||||
<hc:EdgeElement.LeftContent>
|
||||
<Image Source="../../Resources/Img/LeftMainContent/ButtonGroup_16x.png"/>
|
||||
</hc:EdgeElement.LeftContent>
|
||||
</ListBoxItem>
|
||||
<ListBoxItem Tag="{x:Static data:MessageToken.ProgressButtonDemoCtl}" Content="{x:Static langs:Lang.ProgressButton}">
|
||||
<hc:EdgeElement.LeftContent>
|
||||
<Image Source="../../Resources/Img/LeftMainContent/ProgressButton_16x.png"/>
|
||||
|
||||
@@ -58,31 +58,31 @@
|
||||
<RadioButton Margin="10,0,0,0" BorderThickness="1" Style="{StaticResource RadioButtonIcon}" Content="Radio"/>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
<hc:RadioGroup Margin="0,32,0,0">
|
||||
<hc:ButtonGroup Margin="0,32,0,0">
|
||||
<RadioButton Content="Radio" IsChecked="True"/>
|
||||
<RadioButton Content="Radio"/>
|
||||
<RadioButton IsEnabled="False" Content="Radio"/>
|
||||
<RadioButton Content="Radio"/>
|
||||
</hc:RadioGroup>
|
||||
<hc:RadioGroup Margin="0,16,0,0" Style="{StaticResource RadioGroupSolid}">
|
||||
</hc:ButtonGroup>
|
||||
<hc:ButtonGroup Margin="0,16,0,0" Style="{StaticResource ButtonGroupSolid}">
|
||||
<RadioButton Content="Radio"/>
|
||||
<RadioButton Content="Radio"/>
|
||||
<RadioButton IsEnabled="False" Content="Radio"/>
|
||||
<RadioButton Content="Radio" IsChecked="True"/>
|
||||
</hc:RadioGroup>
|
||||
</hc:ButtonGroup>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<hc:RadioGroup Margin="0,16,8,0" Orientation="Vertical">
|
||||
<hc:ButtonGroup Margin="0,16,8,0" Orientation="Vertical">
|
||||
<RadioButton Content="Radio" IsChecked="True"/>
|
||||
<RadioButton Content="Radio"/>
|
||||
<RadioButton IsEnabled="False" Content="Radio"/>
|
||||
<RadioButton Content="Radio"/>
|
||||
</hc:RadioGroup>
|
||||
<hc:RadioGroup Margin="8,16,0,0" Orientation="Vertical" Style="{StaticResource RadioGroupSolid}">
|
||||
</hc:ButtonGroup>
|
||||
<hc:ButtonGroup Margin="8,16,0,0" Orientation="Vertical" Style="{StaticResource ButtonGroupSolid}">
|
||||
<RadioButton Content="Radio"/>
|
||||
<RadioButton Content="Radio"/>
|
||||
<RadioButton IsEnabled="False" Content="Radio"/>
|
||||
<RadioButton Content="Radio" IsChecked="True"/>
|
||||
</hc:RadioGroup>
|
||||
</hc:ButtonGroup>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
@@ -20,31 +20,31 @@
|
||||
<RadioButton Margin="10,0,0,0" BorderThickness="1" Style="{StaticResource RadioButtonIcon}" Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
<hc:RadioGroup Margin="0,32,0,0">
|
||||
<hc:ButtonGroup Margin="0,32,0,0">
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}" IsChecked="True"/>
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
<RadioButton IsEnabled="False" Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
</hc:RadioGroup>
|
||||
<hc:RadioGroup Margin="0,16,0,0" Style="{StaticResource RadioGroupSolid}">
|
||||
</hc:ButtonGroup>
|
||||
<hc:ButtonGroup Margin="0,16,0,0" Style="{StaticResource ButtonGroupSolid}">
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
<RadioButton IsEnabled="False" Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}" IsChecked="True"/>
|
||||
</hc:RadioGroup>
|
||||
</hc:ButtonGroup>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<hc:RadioGroup Margin="0,16,8,0" Orientation="Vertical">
|
||||
<hc:ButtonGroup Margin="0,16,8,0" Orientation="Vertical">
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}" IsChecked="True"/>
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
<RadioButton IsEnabled="False" Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
</hc:RadioGroup>
|
||||
<hc:RadioGroup Margin="8,16,0,0" Orientation="Vertical" Style="{StaticResource RadioGroupSolid}">
|
||||
</hc:ButtonGroup>
|
||||
<hc:ButtonGroup Margin="8,16,0,0" Orientation="Vertical" Style="{StaticResource ButtonGroupSolid}">
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
<RadioButton IsEnabled="False" Content="{x:Static langs:Lang.RadioButton}"/>
|
||||
<RadioButton Content="{x:Static langs:Lang.RadioButton}" IsChecked="True"/>
|
||||
</hc:RadioGroup>
|
||||
</hc:ButtonGroup>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</hc:TransitioningContentControl>
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
Width="340"
|
||||
Height="220">
|
||||
<hc:SimplePanel>
|
||||
<TextBlock Text="{x:Static hc:Lang.Cancel}" />
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,30,0,0">
|
||||
<Path Data="{StaticResource LogoGeometry}" Width="40" Height="40" Fill="#f06632" VerticalAlignment="Top" Margin="0,16,0,0"/>
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,64,0,0">
|
||||
<TextBlock Text="HandyControl" FontSize="30" Foreground="{StaticResource PrimaryBrush}" VerticalAlignment="Top" HorizontalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding Version}" HorizontalAlignment="Center" Margin="0,10,0,0" Foreground="{StaticResource PrimaryBrush}"/>
|
||||
</StackPanel>
|
||||
|
||||
+7
-8
@@ -1,17 +1,16 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using HandyControl.Tools;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class RadioGroup : ItemsControl
|
||||
public class ButtonGroup : ItemsControl
|
||||
{
|
||||
protected override DependencyObject GetContainerForItemOverride() => new RadioButton();
|
||||
|
||||
protected override bool IsItemItsOwnContainerOverride(object item) => item is RadioButton;
|
||||
protected override bool IsItemItsOwnContainerOverride(object item) => item is Button || item is RadioButton || item is ToggleButton;
|
||||
|
||||
public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register(
|
||||
"Orientation", typeof(Orientation), typeof(RadioGroup), new PropertyMetadata(default(Orientation)));
|
||||
"Orientation", typeof(Orientation), typeof(ButtonGroup), new PropertyMetadata(default(Orientation)));
|
||||
|
||||
public Orientation Orientation
|
||||
{
|
||||
@@ -20,7 +19,7 @@ namespace HandyControl.Controls
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ItemStyleSelectorProperty = DependencyProperty.Register(
|
||||
"ItemStyleSelector", typeof(StyleSelector), typeof(RadioGroup), new PropertyMetadata(new RadioGroupItemStyleSelector()));
|
||||
"ItemStyleSelector", typeof(StyleSelector), typeof(ButtonGroup), new PropertyMetadata(new ButtonGroupItemStyleSelector()));
|
||||
|
||||
public StyleSelector ItemStyleSelector
|
||||
{
|
||||
@@ -35,9 +34,9 @@ namespace HandyControl.Controls
|
||||
var count = Items.Count;
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
var item = (RadioButton)Items[i];
|
||||
var item = (ButtonBase)Items[i];
|
||||
item.Style = ItemStyleSelector?.SelectStyle(item, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Media;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
@@ -14,6 +15,7 @@ namespace HandyControl.Controls
|
||||
/// <summary>
|
||||
/// 消息框
|
||||
/// </summary>
|
||||
[SuppressMessage("ReSharper", "RedundantDelegateCreation")]
|
||||
public sealed class MessageBox : Window
|
||||
{
|
||||
private MessageBoxResult _messageBoxResult = MessageBoxResult.Cancel;
|
||||
@@ -31,7 +33,7 @@ namespace HandyControl.Controls
|
||||
|
||||
public string Message
|
||||
{
|
||||
get => (string) GetValue(MessageProperty);
|
||||
get => (string)GetValue(MessageProperty);
|
||||
set => SetValue(MessageProperty, value);
|
||||
}
|
||||
|
||||
@@ -40,7 +42,7 @@ namespace HandyControl.Controls
|
||||
|
||||
public Geometry Image
|
||||
{
|
||||
get => (Geometry) GetValue(ImageProperty);
|
||||
get => (Geometry)GetValue(ImageProperty);
|
||||
set => SetValue(ImageProperty, value);
|
||||
}
|
||||
|
||||
@@ -49,7 +51,7 @@ namespace HandyControl.Controls
|
||||
|
||||
public Brush ImageBrush
|
||||
{
|
||||
get => (Brush) GetValue(ImageBrushProperty);
|
||||
get => (Brush)GetValue(ImageBrushProperty);
|
||||
set => SetValue(ImageBrushProperty, value);
|
||||
}
|
||||
|
||||
@@ -58,7 +60,7 @@ namespace HandyControl.Controls
|
||||
|
||||
public bool ShowImage
|
||||
{
|
||||
get => (bool) GetValue(ShowImageProperty);
|
||||
get => (bool)GetValue(ShowImageProperty);
|
||||
set => SetValue(ShowImageProperty, value);
|
||||
}
|
||||
|
||||
@@ -139,18 +141,7 @@ namespace HandyControl.Controls
|
||||
public static MessageBoxResult Success(string messageBoxText, string caption = null)
|
||||
{
|
||||
MessageBox messageBox = null;
|
||||
#if netle40
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OK);
|
||||
messageBox.ShowImage = true;
|
||||
messageBox.Image = ResourceHelper.GetResource<Geometry>(ResourceToken.SuccessGeometry);
|
||||
messageBox.ImageBrush = ResourceHelper.GetResource<Brush>(ResourceToken.SuccessBrush);
|
||||
messageBox.ShowDialog();
|
||||
}));
|
||||
#else
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OK);
|
||||
@@ -159,8 +150,7 @@ namespace HandyControl.Controls
|
||||
messageBox.ImageBrush = ResourceHelper.GetResource<Brush>(ResourceToken.SuccessBrush);
|
||||
SystemSounds.Asterisk.Play();
|
||||
messageBox.ShowDialog();
|
||||
});
|
||||
#endif
|
||||
}));
|
||||
|
||||
return messageBox._messageBoxResult;
|
||||
}
|
||||
@@ -173,24 +163,14 @@ namespace HandyControl.Controls
|
||||
public static MessageBoxResult Info(string messageBoxText, string caption = null)
|
||||
{
|
||||
MessageBox messageBox = null;
|
||||
#if netle40
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OK);
|
||||
SetImage(messageBox, MessageBoxImage.Information);
|
||||
messageBox.ShowDialog();
|
||||
}));
|
||||
#else
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OK);
|
||||
SetImage(messageBox, MessageBoxImage.Information);
|
||||
SystemSounds.Asterisk.Play();
|
||||
messageBox.ShowDialog();
|
||||
});
|
||||
#endif
|
||||
}));
|
||||
|
||||
return messageBox._messageBoxResult;
|
||||
}
|
||||
@@ -203,24 +183,14 @@ namespace HandyControl.Controls
|
||||
public static MessageBoxResult Warning(string messageBoxText, string caption = null)
|
||||
{
|
||||
MessageBox messageBox = null;
|
||||
#if netle40
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OK);
|
||||
SetImage(messageBox, MessageBoxImage.Warning);
|
||||
messageBox.ShowDialog();
|
||||
}));
|
||||
#else
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OK);
|
||||
SetImage(messageBox, MessageBoxImage.Warning);
|
||||
SystemSounds.Asterisk.Play();
|
||||
messageBox.ShowDialog();
|
||||
});
|
||||
#endif
|
||||
}));
|
||||
|
||||
return messageBox._messageBoxResult;
|
||||
}
|
||||
@@ -233,24 +203,14 @@ namespace HandyControl.Controls
|
||||
public static MessageBoxResult Error(string messageBoxText, string caption = null)
|
||||
{
|
||||
MessageBox messageBox = null;
|
||||
#if netle40
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OK);
|
||||
SetImage(messageBox, MessageBoxImage.Error);
|
||||
messageBox.ShowDialog();
|
||||
}));
|
||||
#else
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OK);
|
||||
SetImage(messageBox, MessageBoxImage.Error);
|
||||
SystemSounds.Asterisk.Play();
|
||||
messageBox.ShowDialog();
|
||||
});
|
||||
#endif
|
||||
}));
|
||||
|
||||
return messageBox._messageBoxResult;
|
||||
}
|
||||
@@ -263,18 +223,7 @@ namespace HandyControl.Controls
|
||||
public static MessageBoxResult Fatal(string messageBoxText, string caption = null)
|
||||
{
|
||||
MessageBox messageBox = null;
|
||||
#if netle40
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OK);
|
||||
messageBox.ShowImage = true;
|
||||
messageBox.Image = ResourceHelper.GetResource<Geometry>(ResourceToken.FatalGeometry);
|
||||
messageBox.ImageBrush = ResourceHelper.GetResource<Brush>(ResourceToken.PrimaryTextBrush);
|
||||
messageBox.ShowDialog();
|
||||
}));
|
||||
#else
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OK);
|
||||
@@ -283,8 +232,7 @@ namespace HandyControl.Controls
|
||||
messageBox.ImageBrush = ResourceHelper.GetResource<Brush>(ResourceToken.PrimaryTextBrush);
|
||||
SystemSounds.Asterisk.Play();
|
||||
messageBox.ShowDialog();
|
||||
});
|
||||
#endif
|
||||
}));
|
||||
|
||||
return messageBox._messageBoxResult;
|
||||
}
|
||||
@@ -297,24 +245,14 @@ namespace HandyControl.Controls
|
||||
public static MessageBoxResult Ask(string messageBoxText, string caption = null)
|
||||
{
|
||||
MessageBox messageBox = null;
|
||||
#if netle40
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OKCancel);
|
||||
SetImage(messageBox, MessageBoxImage.Question);
|
||||
messageBox.ShowDialog();
|
||||
}));
|
||||
#else
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel);
|
||||
SetButtonStatus(messageBox, MessageBoxButton.OKCancel);
|
||||
SetImage(messageBox, MessageBoxImage.Question);
|
||||
SystemSounds.Asterisk.Play();
|
||||
messageBox.ShowDialog();
|
||||
});
|
||||
#endif
|
||||
}));
|
||||
|
||||
return messageBox._messageBoxResult;
|
||||
}
|
||||
@@ -327,7 +265,6 @@ namespace HandyControl.Controls
|
||||
public static MessageBoxResult Show(MessageBoxInfo info)
|
||||
{
|
||||
MessageBox messageBox = null;
|
||||
#if netle40
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(null, info.MessageBoxText, info.Caption, info.Button, MessageBoxImage.None, info.DefaultResult);
|
||||
@@ -340,33 +277,13 @@ namespace HandyControl.Controls
|
||||
messageBox.ImageBrush = ResourceHelper.GetResource<Brush>(info.IconBrushKey);
|
||||
}
|
||||
|
||||
if (info.Style != null)
|
||||
{
|
||||
messageBox.Style = info.Style;
|
||||
}
|
||||
messageBox.ShowDialog();
|
||||
}));
|
||||
#else
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(null, info.MessageBoxText, info.Caption, info.Button, MessageBoxImage.None, info.DefaultResult);
|
||||
SetButtonStatus(messageBox, info.Button);
|
||||
|
||||
if (!string.IsNullOrEmpty(info.IconKey))
|
||||
{
|
||||
messageBox.ShowImage = true;
|
||||
messageBox.Image = ResourceHelper.GetResource<Geometry>(info.IconKey);
|
||||
messageBox.ImageBrush = ResourceHelper.GetResource<Brush>(info.IconBrushKey);
|
||||
}
|
||||
|
||||
if (info.Style != null)
|
||||
{
|
||||
messageBox.Style = info.Style;
|
||||
}
|
||||
SystemSounds.Asterisk.Play();
|
||||
messageBox.ShowDialog();
|
||||
});
|
||||
#endif
|
||||
}));
|
||||
|
||||
return messageBox._messageBoxResult;
|
||||
}
|
||||
@@ -398,24 +315,14 @@ namespace HandyControl.Controls
|
||||
public static MessageBoxResult Show(System.Windows.Window owner, string messageBoxText, string caption = null, MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage icon = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.None)
|
||||
{
|
||||
MessageBox messageBox = null;
|
||||
#if netle40
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(owner, messageBoxText, caption, button, icon, defaultResult);
|
||||
SetButtonStatus(messageBox, button);
|
||||
SetImage(messageBox, icon);
|
||||
messageBox.ShowDialog();
|
||||
}));
|
||||
#else
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
messageBox = CreateMessageBox(owner, messageBoxText, caption, button, icon, defaultResult);
|
||||
SetButtonStatus(messageBox, button);
|
||||
SetImage(messageBox, icon);
|
||||
SystemSounds.Asterisk.Play();
|
||||
messageBox.ShowDialog();
|
||||
});
|
||||
#endif
|
||||
}));
|
||||
|
||||
return messageBox._messageBoxResult;
|
||||
}
|
||||
@@ -540,4 +447,4 @@ namespace HandyControl.Controls
|
||||
|| value == MessageBoxResult.Yes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,30 @@
|
||||
|
||||
internal const string RadioGroupItemVerticalLast = nameof(RadioGroupItemVerticalLast);
|
||||
|
||||
internal const string ButtonGroupItemDefault = nameof(ButtonGroupItemDefault);
|
||||
|
||||
internal const string ButtonGroupItemSingle = nameof(ButtonGroupItemSingle);
|
||||
|
||||
internal const string ButtonGroupItemHorizontalFirst = nameof(ButtonGroupItemHorizontalFirst);
|
||||
|
||||
internal const string ButtonGroupItemHorizontalLast = nameof(ButtonGroupItemHorizontalLast);
|
||||
|
||||
internal const string ButtonGroupItemVerticalFirst = nameof(ButtonGroupItemVerticalFirst);
|
||||
|
||||
internal const string ButtonGroupItemVerticalLast = nameof(ButtonGroupItemVerticalLast);
|
||||
|
||||
internal const string ToggleButtonGroupItemDefault = nameof(ToggleButtonGroupItemDefault);
|
||||
|
||||
internal const string ToggleButtonGroupItemSingle = nameof(ToggleButtonGroupItemSingle);
|
||||
|
||||
internal const string ToggleButtonGroupItemHorizontalFirst = nameof(ToggleButtonGroupItemHorizontalFirst);
|
||||
|
||||
internal const string ToggleButtonGroupItemHorizontalLast = nameof(ToggleButtonGroupItemHorizontalLast);
|
||||
|
||||
internal const string ToggleButtonGroupItemVerticalFirst = nameof(ToggleButtonGroupItemVerticalFirst);
|
||||
|
||||
internal const string ToggleButtonGroupItemVerticalLast = nameof(ToggleButtonGroupItemVerticalLast);
|
||||
|
||||
internal const string TabItemCapsuleDefault = nameof(TabItemCapsuleDefault);
|
||||
|
||||
internal const string TabItemCapsuleSingle = nameof(TabItemCapsuleSingle);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\InfoElement.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\PanelElement.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\PasswordBoxAttach.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\ButtonGroup.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" />
|
||||
@@ -77,7 +78,6 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Growl.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\NotifyIcon.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Pagination.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\RadioGroup.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\ScrollViewer.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Shield.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\TransitioningContentControl.cs" />
|
||||
@@ -278,7 +278,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Queue\Deque!1.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\RegularJudgment.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\RegularPatterns.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\StyleSelector\RadioGroupItemStyleSelector.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\StyleSelector\ButtonGroupItemStyleSelector.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\StyleSelector\TabItemCapsuleStyleSelector.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -466,7 +466,7 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\RadioGroupBaseStyle.xaml">
|
||||
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\ButtonGroupBaseStyle.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
@@ -662,7 +662,7 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\RadioGroup.xaml">
|
||||
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\ButtonGroup.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
|
||||
@@ -12,7 +12,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: AssemblyVersion("1.5.5")]
|
||||
[assembly: AssemblyVersion("2.0.0")]
|
||||
#endif
|
||||
|
||||
[assembly: XmlnsDefinition("https://handyorg.github.io/handycontrol", "HandyControl.Controls")]
|
||||
|
||||
@@ -46,4 +46,45 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ButtonGroupItemBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="Button">
|
||||
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="0"/>
|
||||
<Setter Property="Height" Value="{StaticResource DefaultControlHeight}"/>
|
||||
<Setter Property="Padding" Value="10,0"/>
|
||||
<Setter Property="Margin" Value="-1,0,0,0"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border x:Name="BorderRoot" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
|
||||
<ContentPresenter x:Name="contentPresenter" TextElement.Foreground="{TemplateBinding Foreground}" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="TextElement.Foreground" Value="{DynamicResource PrimaryBrush}" TargetName="contentPresenter"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value="0.4"/>
|
||||
</Trigger>
|
||||
<DataTrigger Binding="{Binding Orientation,RelativeSource={RelativeSource AncestorType=controls:ButtonGroup}}" Value="Vertical">
|
||||
<Setter Property="Margin" Value="0,-1,0,0"/>
|
||||
</DataTrigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkDefaultBrush}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource BorderBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
+6
-5
@@ -2,24 +2,25 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||
|
||||
<ItemsPanelTemplate x:Key="RadioGroupHorizontalItemsPanelTemplate">
|
||||
<ItemsPanelTemplate x:Key="ButtonGroupHorizontalItemsPanelTemplate">
|
||||
<UniformGrid FocusVisualStyle="{x:Null}" Rows="1"/>
|
||||
</ItemsPanelTemplate>
|
||||
|
||||
<ItemsPanelTemplate x:Key="RadioGroupVerticalItemsPanelTemplate">
|
||||
<ItemsPanelTemplate x:Key="ButtonGroupVerticalItemsPanelTemplate">
|
||||
<UniformGrid FocusVisualStyle="{x:Null}" Columns="1"/>
|
||||
</ItemsPanelTemplate>
|
||||
|
||||
<Style x:Key="RadioGroupBaseStyle" TargetType="controls:RadioGroup">
|
||||
<Style x:Key="ButtonGroupBaseStyle" TargetType="controls:ButtonGroup">
|
||||
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="Focusable" Value="False"/>
|
||||
<Setter Property="ItemsPanel" Value="{StaticResource RadioGroupHorizontalItemsPanelTemplate}"/>
|
||||
<Setter Property="ItemsPanel" Value="{StaticResource ButtonGroupHorizontalItemsPanelTemplate}"/>
|
||||
<Setter Property="controls:TitleElement.BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
|
||||
<Setter Property="controls:TitleElement.Background" Value="{DynamicResource RegionBrush}"/>
|
||||
<Setter Property="controls:TitleElement.Foreground" Value="{DynamicResource PrimaryBrush}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="Orientation" Value="Vertical">
|
||||
<Setter Property="ItemsPanel" Value="{StaticResource RadioGroupVerticalItemsPanelTemplate}"/>
|
||||
<Setter Property="ItemsPanel" Value="{StaticResource ButtonGroupVerticalItemsPanelTemplate}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
@@ -196,9 +196,15 @@
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter Property="Panel.ZIndex" Value="{x:Static system:Int32.MaxValue}"/>
|
||||
</Trigger>
|
||||
<DataTrigger Binding="{Binding Orientation,RelativeSource={RelativeSource AncestorType=controls:RadioGroup}}" Value="Vertical">
|
||||
<DataTrigger Binding="{Binding Orientation,RelativeSource={RelativeSource AncestorType=controls:ButtonGroup}}" Value="Vertical">
|
||||
<Setter Property="Margin" Value="0,-1,0,0"/>
|
||||
</DataTrigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkDefaultBrush}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource BorderBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<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:controls="clr-namespace:HandyControl.Controls"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ButtonBaseBaseStyle.xaml"/>
|
||||
@@ -218,4 +219,53 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToggleButtonGroupItemBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="ToggleButton">
|
||||
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="0"/>
|
||||
<Setter Property="Height" Value="{StaticResource DefaultControlHeight}"/>
|
||||
<Setter Property="Padding" Value="10,0"/>
|
||||
<Setter Property="Margin" Value="-1,0,0,0"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ToggleButton">
|
||||
<Border x:Name="BorderRoot" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
|
||||
<ContentPresenter x:Name="contentPresenter" TextElement.Foreground="{TemplateBinding Foreground}" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="TextElement.Foreground" Value="{DynamicResource PrimaryBrush}" TargetName="contentPresenter"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="true">
|
||||
<Setter Property="BorderBrush" Value="{Binding Path=(controls:TitleElement.BorderBrush),RelativeSource={RelativeSource TemplatedParent}}" TargetName="BorderRoot"/>
|
||||
<Setter Property="Background" Value="{Binding Path=(controls:TitleElement.Background),RelativeSource={RelativeSource TemplatedParent}}" TargetName="BorderRoot"/>
|
||||
<Setter Property="TextElement.Foreground" Value="{Binding Path=(controls:TitleElement.Foreground),RelativeSource={RelativeSource TemplatedParent}}" TargetName="contentPresenter"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value="0.4"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter Property="Panel.ZIndex" Value="{x:Static system:Int32.MaxValue}"/>
|
||||
</Trigger>
|
||||
<DataTrigger Binding="{Binding Orientation,RelativeSource={RelativeSource AncestorType=controls:ButtonGroup}}" Value="Vertical">
|
||||
<Setter Property="Margin" Value="0,-1,0,0"/>
|
||||
</DataTrigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkDefaultBrush}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource BorderBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -81,4 +81,28 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ButtonGroupItemDefault" BasedOn="{StaticResource ButtonGroupItemBaseStyle}" TargetType="Button"/>
|
||||
|
||||
<Style x:Key="ButtonGroupItemHorizontalFirst" BasedOn="{StaticResource ButtonGroupItemBaseStyle}" TargetType="Button">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="4,0,0,4"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ButtonGroupItemHorizontalLast" BasedOn="{StaticResource ButtonGroupItemBaseStyle}" TargetType="Button">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="0,4,4,0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ButtonGroupItemSingle" BasedOn="{StaticResource ButtonGroupItemBaseStyle}" TargetType="Button">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="4"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ButtonGroupItemVerticalFirst" BasedOn="{StaticResource ButtonGroupItemBaseStyle}" TargetType="Button">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="4,4,0,0"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ButtonGroupItemVerticalLast" BasedOn="{StaticResource ButtonGroupItemBaseStyle}" TargetType="Button">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="0,0,4,4"/>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
+3
-3
@@ -3,12 +3,12 @@
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Base/RadioGroupBaseStyle.xaml"/>
|
||||
<ResourceDictionary Source="Base/ButtonGroupBaseStyle.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style BasedOn="{StaticResource RadioGroupBaseStyle}" TargetType="controls:RadioGroup"/>
|
||||
<Style BasedOn="{StaticResource ButtonGroupBaseStyle}" TargetType="controls:ButtonGroup"/>
|
||||
|
||||
<Style x:Key="RadioGroupSolid" BasedOn="{StaticResource RadioGroupBaseStyle}" TargetType="controls:RadioGroup">
|
||||
<Style x:Key="ButtonGroupSolid" BasedOn="{StaticResource ButtonGroupBaseStyle}" TargetType="controls:ButtonGroup">
|
||||
<Setter Property="controls:TitleElement.BorderBrush" Value="{DynamicResource TitleBrush}"/>
|
||||
<Setter Property="controls:TitleElement.Background" Value="{DynamicResource TitleBrush}"/>
|
||||
<Setter Property="controls:TitleElement.Foreground" Value="{DynamicResource TextIconBrush}"/>
|
||||
@@ -49,7 +49,7 @@
|
||||
<ResourceDictionary Source="ToolBar.xaml"/>
|
||||
<ResourceDictionary Source="SearchBar.xaml"/>
|
||||
<ResourceDictionary Source="Tag.xaml"/>
|
||||
<ResourceDictionary Source="RadioGroup.xaml"/>
|
||||
<ResourceDictionary Source="ButtonGroup.xaml"/>
|
||||
<ResourceDictionary Source="FlipClock.xaml"/>
|
||||
<ResourceDictionary Source="Rate.xaml"/>
|
||||
<ResourceDictionary Source="Shield.xaml"/>
|
||||
|
||||
@@ -264,4 +264,28 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToggleButtonGroupItemDefault" BasedOn="{StaticResource ToggleButtonGroupItemBaseStyle}" TargetType="ToggleButton"/>
|
||||
|
||||
<Style x:Key="ToggleButtonGroupItemHorizontalFirst" BasedOn="{StaticResource ToggleButtonGroupItemBaseStyle}" TargetType="ToggleButton">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="4,0,0,4"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToggleButtonGroupItemHorizontalLast" BasedOn="{StaticResource ToggleButtonGroupItemBaseStyle}" TargetType="ToggleButton">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="0,4,4,0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToggleButtonGroupItemSingle" BasedOn="{StaticResource ToggleButtonGroupItemBaseStyle}" TargetType="ToggleButton">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="4"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToggleButtonGroupItemVerticalFirst" BasedOn="{StaticResource ToggleButtonGroupItemBaseStyle}" TargetType="ToggleButton">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="4,4,0,0"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToggleButtonGroupItemVerticalLast" BasedOn="{StaticResource ToggleButtonGroupItemBaseStyle}" TargetType="ToggleButton">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="0,0,4,4"/>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,87 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControl.Tools
|
||||
{
|
||||
public class ButtonGroupItemStyleSelector : StyleSelector
|
||||
{
|
||||
public override Style SelectStyle(object item, DependencyObject container)
|
||||
{
|
||||
if (container is ButtonGroup buttonGroup && item is ButtonBase buttonBase)
|
||||
{
|
||||
var count = buttonGroup.Items.Count;
|
||||
|
||||
switch (buttonBase)
|
||||
{
|
||||
case RadioButton _:
|
||||
{
|
||||
if (count == 1)
|
||||
{
|
||||
return ResourceHelper.GetResource<Style>(ResourceToken.RadioGroupItemSingle);
|
||||
}
|
||||
|
||||
var index = buttonGroup.Items.IndexOf(buttonBase);
|
||||
return buttonGroup.Orientation == Orientation.Horizontal
|
||||
? index == 0
|
||||
? ResourceHelper.GetResource<Style>(ResourceToken.RadioGroupItemHorizontalFirst)
|
||||
: ResourceHelper.GetResource<Style>(index == count - 1
|
||||
? ResourceToken.RadioGroupItemHorizontalLast
|
||||
: ResourceToken.RadioGroupItemDefault)
|
||||
: index == 0
|
||||
? ResourceHelper.GetResource<Style>(ResourceToken.RadioGroupItemVerticalFirst)
|
||||
: ResourceHelper.GetResource<Style>(index == count - 1
|
||||
? ResourceToken.RadioGroupItemVerticalLast
|
||||
: ResourceToken.RadioGroupItemDefault);
|
||||
}
|
||||
|
||||
case Button _:
|
||||
{
|
||||
if (count == 1)
|
||||
{
|
||||
return ResourceHelper.GetResource<Style>(ResourceToken.ButtonGroupItemSingle);
|
||||
}
|
||||
|
||||
var index = buttonGroup.Items.IndexOf(buttonBase);
|
||||
return buttonGroup.Orientation == Orientation.Horizontal
|
||||
? index == 0
|
||||
? ResourceHelper.GetResource<Style>(ResourceToken.ButtonGroupItemHorizontalFirst)
|
||||
: ResourceHelper.GetResource<Style>(index == count - 1
|
||||
? ResourceToken.ButtonGroupItemHorizontalLast
|
||||
: ResourceToken.ButtonGroupItemDefault)
|
||||
: index == 0
|
||||
? ResourceHelper.GetResource<Style>(ResourceToken.ButtonGroupItemVerticalFirst)
|
||||
: ResourceHelper.GetResource<Style>(index == count - 1
|
||||
? ResourceToken.ButtonGroupItemVerticalLast
|
||||
: ResourceToken.ButtonGroupItemDefault);
|
||||
}
|
||||
|
||||
case ToggleButton _:
|
||||
{
|
||||
if (count == 1)
|
||||
{
|
||||
return ResourceHelper.GetResource<Style>(ResourceToken.ToggleButtonGroupItemSingle);
|
||||
}
|
||||
|
||||
var index = buttonGroup.Items.IndexOf(buttonBase);
|
||||
return buttonGroup.Orientation == Orientation.Horizontal
|
||||
? index == 0
|
||||
? ResourceHelper.GetResource<Style>(ResourceToken.ToggleButtonGroupItemHorizontalFirst)
|
||||
: ResourceHelper.GetResource<Style>(index == count - 1
|
||||
? ResourceToken.ToggleButtonGroupItemHorizontalLast
|
||||
: ResourceToken.ToggleButtonGroupItemDefault)
|
||||
: index == 0
|
||||
? ResourceHelper.GetResource<Style>(ResourceToken.ToggleButtonGroupItemVerticalFirst)
|
||||
: ResourceHelper.GetResource<Style>(index == count - 1
|
||||
? ResourceToken.ToggleButtonGroupItemVerticalLast
|
||||
: ResourceToken.ToggleButtonGroupItemDefault);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControl.Tools
|
||||
{
|
||||
public class RadioGroupItemStyleSelector : StyleSelector
|
||||
{
|
||||
public override Style SelectStyle(object item, DependencyObject container)
|
||||
{
|
||||
if (container is RadioGroup radioGroup && item is UIElement radioButton)
|
||||
{
|
||||
var count = radioGroup.Items.Count;
|
||||
if (count == 1)
|
||||
{
|
||||
return ResourceHelper.GetResource<Style>(ResourceToken.RadioGroupItemSingle);
|
||||
}
|
||||
|
||||
var index = radioGroup.Items.IndexOf(radioButton);
|
||||
return radioGroup.Orientation == Orientation.Horizontal
|
||||
? index == 0
|
||||
? ResourceHelper.GetResource<Style>(ResourceToken.RadioGroupItemHorizontalFirst)
|
||||
: ResourceHelper.GetResource<Style>(index == count - 1
|
||||
? ResourceToken.RadioGroupItemHorizontalLast
|
||||
: ResourceToken.RadioGroupItemDefault)
|
||||
: index == 0
|
||||
? ResourceHelper.GetResource<Style>(ResourceToken.RadioGroupItemVerticalFirst)
|
||||
: ResourceHelper.GetResource<Style>(index == count - 1
|
||||
? ResourceToken.RadioGroupItemVerticalLast
|
||||
: ResourceToken.RadioGroupItemDefault);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user