init branch

This commit is contained in:
NaBian committed 2019-09-03 23:27:19 +08:00
1 parent 5a1bed83a2
commit a54fc69869
23 files changed
+170 -31

No files matched your search

@@ -417,6 +417,9 @@
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\thumbs_up.png"> <Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\thumbs_up.png">
<Link>Resources\Img\thumbs_up.png</Link> <Link>Resources\Img\thumbs_up.png</Link>
</Resource> </Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\SplitButton_16x.png">
<Link>Resources\Img\SplitButton_16x.png</Link>
</Resource>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\Lang.en.resx"> <EmbeddedResource Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\Lang.en.resx">
@@ -429,6 +429,9 @@
<Generator>TextTemplatingFileGenerator</Generator> <Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>MessageToken.cs</LastGenOutput> <LastGenOutput>MessageToken.cs</LastGenOutput>
</Content> </Content>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\SplitButton_16x.png">
<Link>Resources\Img\LeftMainContent\SplitButton_16x.png</Link>
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\thumbs_up.png"> <Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\thumbs_up.png">
<Link>Resources\Img\LeftMainContent\thumbs_up.png</Link> <Link>Resources\Img\LeftMainContent\thumbs_up.png</Link>
</Resource> </Resource>
@@ -492,6 +492,9 @@
<Generator>TextTemplatingFileGenerator</Generator> <Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>MessageToken.cs</LastGenOutput> <LastGenOutput>MessageToken.cs</LastGenOutput>
</Content> </Content>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\SplitButton_16x.png">
<Link>Resources\Img\LeftMainContent\SplitButton_16x.png</Link>
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\thumbs_up.png"> <Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\thumbs_up.png">
<Link>Resources\Img\LeftMainContent\thumbs_up.png</Link> <Link>Resources\Img\LeftMainContent\thumbs_up.png</Link>
</Resource> </Resource>
@@ -116,6 +116,8 @@
public static readonly string FloatingBlockDemoCtl = nameof(FloatingBlockDemoCtl); public static readonly string FloatingBlockDemoCtl = nameof(FloatingBlockDemoCtl);
public static readonly string SplitButtonDemoCtl = nameof(SplitButtonDemoCtl);
public static readonly string ButtonDemoCtl = nameof(ButtonDemoCtl); public static readonly string ButtonDemoCtl = nameof(ButtonDemoCtl);
public static readonly string RepeatButtonDemoCtl = nameof(RepeatButtonDemoCtl); public static readonly string RepeatButtonDemoCtl = nameof(RepeatButtonDemoCtl);
@@ -60,7 +60,8 @@ var controlList = new List<string>
"HoneycombPanelDemoCtl", "HoneycombPanelDemoCtl",
"SpriteDemoCtl", "SpriteDemoCtl",
"NotificationDemoCtl", "NotificationDemoCtl",
"FloatingBlockDemoCtl" "FloatingBlockDemoCtl",
"SplitButtonDemoCtl"
}; };
var styleList = new List<string> var styleList = new List<string>
{ {
@@ -183,6 +183,9 @@
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\SideMenuDemoCtl.xaml.cs"> <Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\SideMenuDemoCtl.xaml.cs">
<DependentUpon>SideMenuDemoCtl.xaml</DependentUpon> <DependentUpon>SideMenuDemoCtl.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\SplitButtonDemoCtl.xaml.cs">
<DependentUpon>SplitButtonDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\SpriteDemoCtl.xaml.cs"> <Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\SpriteDemoCtl.xaml.cs">
<DependentUpon>SpriteDemoCtl.xaml</DependentUpon> <DependentUpon>SpriteDemoCtl.xaml</DependentUpon>
</Compile> </Compile>
@@ -621,6 +624,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\SplitButtonDemoCtl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\SpriteDemoCtl.xaml"> <Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\SpriteDemoCtl.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
@@ -1401,6 +1401,15 @@ namespace HandyControlDemo.Properties.Langs {
} }
} }
/// <summary>
/// 查找类似 分割按钮 的本地化字符串。
/// </summary>
public static string SplitButton {
get {
return ResourceManager.GetString("SplitButton", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 精灵 的本地化字符串。 /// 查找类似 精灵 的本地化字符串。
/// </summary> /// </summary>
@@ -663,4 +663,7 @@
<data name="FloatingBlock" xml:space="preserve"> <data name="FloatingBlock" xml:space="preserve">
<value>FloatingBlock</value> <value>FloatingBlock</value>
</data> </data>
<data name="SplitButton" xml:space="preserve">
<value>SplitButton</value>
</data>
</root> </root>
@@ -663,4 +663,7 @@
<data name="FloatingBlock" xml:space="preserve"> <data name="FloatingBlock" xml:space="preserve">
<value>FloatingBlock</value> <value>FloatingBlock</value>
</data> </data>
<data name="SplitButton" xml:space="preserve">
<value>SplitButton</value>
</data>
</root> </root>
@@ -663,4 +663,7 @@
<data name="FloatingBlock" xml:space="preserve"> <data name="FloatingBlock" xml:space="preserve">
<value>FloatingBlock</value> <value>FloatingBlock</value>
</data> </data>
<data name="SplitButton" xml:space="preserve">
<value>SplitButton</value>
</data>
</root> </root>
@@ -663,4 +663,7 @@
<data name="FloatingBlock" xml:space="preserve"> <data name="FloatingBlock" xml:space="preserve">
<value>漂浮块</value> <value>漂浮块</value>
</data> </data>
<data name="SplitButton" xml:space="preserve">
<value>分割按钮</value>
</data>
</root> </root>
Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

@@ -0,0 +1,6 @@
<UserControl x:Class="HandyControlDemo.UserControl.SplitButtonDemoCtl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:userControl="clr-namespace:HandyControlDemo.UserControl">
<userControl:UnderConstruction/>
</UserControl>
@@ -0,0 +1,10 @@
namespace HandyControlDemo.UserControl
{
public partial class SplitButtonDemoCtl
{
public SplitButtonDemoCtl()
{
InitializeComponent();
}
}
}
@@ -225,6 +225,11 @@
<Image Source="../../Resources/Img/LeftMainContent/GoToTop_16x.png"/> <Image Source="../../Resources/Img/LeftMainContent/GoToTop_16x.png"/>
</hc:EdgeElement.LeftContent> </hc:EdgeElement.LeftContent>
</ListBoxItem> </ListBoxItem>
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.SplitButtonDemoCtl}" Content="{x:Static langs:Lang.SplitButton}">
<hc:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/LeftMainContent/SplitButton_16x.png"/>
</hc:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.ButtonGroupDemoCtl}" Content="{x:Static langs:Lang.ButtonGroup}"> <ListBoxItem Tag="{x:Static data:MessageToken.ButtonGroupDemoCtl}" Content="{x:Static langs:Lang.ButtonGroup}">
<hc:EdgeElement.LeftContent> <hc:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/LeftMainContent/ButtonGroup_16x.png"/> <Image Source="../../Resources/Img/LeftMainContent/ButtonGroup_16x.png"/>
@@ -330,7 +335,7 @@
<Image Source="../../Resources/Img/LeftMainContent/TextBlock_16x.png"/> <Image Source="../../Resources/Img/LeftMainContent/TextBlock_16x.png"/>
</hc:EdgeElement.LeftContent> </hc:EdgeElement.LeftContent>
</ListBoxItem> </ListBoxItem>
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.RunningBlockDemoCtl}" Content="{x:Static langs:Lang.RunningBlock}"> <ListBoxItem Tag="{x:Static data:MessageToken.RunningBlockDemoCtl}" Content="{x:Static langs:Lang.RunningBlock}">
<hc:EdgeElement.LeftContent> <hc:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/LeftMainContent/Dynamic_16x.png"/> <Image Source="../../Resources/Img/LeftMainContent/Dynamic_16x.png"/>
</hc:EdgeElement.LeftContent> </hc:EdgeElement.LeftContent>
@@ -0,0 +1,18 @@
using System.Windows;
using System.Windows.Controls.Primitives;
using HandyControl.Data.Enum;
namespace HandyControl.Controls
{
public class SplitButton : ButtonBase
{
public static readonly DependencyProperty HitModeProperty = DependencyProperty.Register(
"HitMode", typeof(MouseHitMode), typeof(SplitButton), new PropertyMetadata(default(MouseHitMode)));
public MouseHitMode HitMode
{
get => (MouseHitMode) GetValue(HitModeProperty);
set => SetValue(HitModeProperty, value);
}
}
}
@@ -4,6 +4,7 @@ using System.Diagnostics.CodeAnalysis;
using System.Linq; using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Markup;
using System.Windows.Media.Animation; using System.Windows.Media.Animation;
using HandyControl.Data; using HandyControl.Data;
using HandyControl.Tools; using HandyControl.Tools;
@@ -14,7 +15,8 @@ namespace HandyControl.Controls
[TemplateVisualState(GroupName = PresentationGroup, Name = DefaultTransitionState)] [TemplateVisualState(GroupName = PresentationGroup, Name = DefaultTransitionState)]
[TemplatePart(Name = PreviousContentPresentationSitePartName, Type = typeof(ContentControl))] [TemplatePart(Name = PreviousContentPresentationSitePartName, Type = typeof(ContentControl))]
[TemplatePart(Name = CurrentContentPresentationSitePartName, Type = typeof(ContentControl))] [TemplatePart(Name = CurrentContentPresentationSitePartName, Type = typeof(ContentControl))]
public class TransitioningContentControl : ContentControl [ContentProperty("Content")]
public class TransitioningContentControl : Control
{ {
private Storyboard _currentTransition; private Storyboard _currentTransition;
@@ -76,11 +78,28 @@ namespace HandyControl.Controls
VisualStateManager.GoToState(this, Transition, true); VisualStateManager.GoToState(this, Transition, true);
} }
protected override void OnContentChanged(object oldContent, object newContent) public static readonly DependencyProperty ContentProperty = DependencyProperty.Register(
{ "Content", typeof(object), typeof(TransitioningContentControl), new PropertyMetadata(default(object), OnContentChanged));
base.OnContentChanged(oldContent, newContent);
StartTransition(oldContent, newContent); private static void OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var ctl = (TransitioningContentControl) d;
ctl.StartTransition(e.OldValue, e.NewValue);
}
public static readonly DependencyProperty ContentTemplateProperty = DependencyProperty.Register(
"ContentTemplate", typeof(DataTemplate), typeof(TransitioningContentControl), new PropertyMetadata(default(DataTemplate)));
public DataTemplate ContentTemplate
{
get => (DataTemplate) GetValue(ContentTemplateProperty);
set => SetValue(ContentTemplateProperty, value);
}
public object Content
{
get => GetValue(ContentProperty);
set => SetValue(ContentProperty, value);
} }
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "newContent", Justification = "Should be used in the future.")] [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "newContent", Justification = "Should be used in the future.")]
@@ -0,0 +1,8 @@
namespace HandyControl.Data.Enum
{
public enum MouseHitMode
{
Click,
Hover
}
}
@@ -21,6 +21,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\RectangleAttach.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\RectangleAttach.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\TextBlockAttach.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\TextBlockAttach.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Block\FloatingBlock.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Controls\Block\FloatingBlock.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Button\SplitButton.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Growl\GrowlWindow.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Controls\Growl\GrowlWindow.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Image\ImageBlock.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Controls\Image\ImageBlock.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Magnifier.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Magnifier.cs" />
@@ -34,6 +35,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\RangeThumb.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\RangeThumb.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\TwoWayRangeBase.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\TwoWayRangeBase.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Block\RunningBlock.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Controls\Block\RunningBlock.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\MouseHitMode.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\ShowAnimation.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Data\Enum\ShowAnimation.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\CloseWindowCommand.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\CloseWindowCommand.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\OpenLinkCommand.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\OpenLinkCommand.cs" />
@@ -390,6 +392,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\SplitButtonBaseStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\ToggleBlockBaseStyle.xaml"> <Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\ToggleBlockBaseStyle.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
@@ -778,6 +784,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\SplitButton.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Sprite.xaml"> <Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Sprite.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
@@ -0,0 +1,14 @@
<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="ButtonBaseBaseStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="SplitButtonBaseStyle" BasedOn="{StaticResource ButtonBaseBaseStyle}" TargetType="controls:SplitButton">
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
</Style>
</ResourceDictionary>
@@ -0,0 +1,10 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:controls="clr-namespace:HandyControl.Controls">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Base/SplitButtonBaseStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style BasedOn="{StaticResource SplitButtonBaseStyle}" TargetType="controls:SplitButton"/>
</ResourceDictionary>
@@ -74,6 +74,7 @@
<ResourceDictionary Source="Sprite.xaml"/> <ResourceDictionary Source="Sprite.xaml"/>
<ResourceDictionary Source="Notification.xaml"/> <ResourceDictionary Source="Notification.xaml"/>
<ResourceDictionary Source="FloatingBlock.xaml"/> <ResourceDictionary Source="FloatingBlock.xaml"/>
<ResourceDictionary Source="SplitButton.xaml"/>
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>
@@ -11,7 +11,7 @@
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="controls:TransitioningContentControl"> <ControlTemplate TargetType="controls:TransitioningContentControl">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2"> <controls:SimplePanel>
<VisualStateManager.VisualStateGroups> <VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="PresentationStates"> <VisualStateGroup x:Name="PresentationStates">
<VisualState x:Name="DefaultTransition"> <VisualState x:Name="DefaultTransition">
@@ -76,29 +76,27 @@
</VisualState> </VisualState>
</VisualStateGroup> </VisualStateGroup>
</VisualStateManager.VisualStateGroups> </VisualStateManager.VisualStateGroups>
<controls:SimplePanel> <ContentPresenter x:Name="PreviousContentPresentationSite" Content="{x:Null}" ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<ContentPresenter x:Name="PreviousContentPresentationSite" Content="{x:Null}" ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> <ContentPresenter.RenderTransform>
<ContentPresenter.RenderTransform> <TransformGroup>
<TransformGroup> <ScaleTransform />
<ScaleTransform /> <SkewTransform />
<SkewTransform /> <RotateTransform />
<RotateTransform /> <TranslateTransform />
<TranslateTransform /> </TransformGroup>
</TransformGroup> </ContentPresenter.RenderTransform>
</ContentPresenter.RenderTransform> </ContentPresenter>
</ContentPresenter> <ContentPresenter x:Name="CurrentContentPresentationSite" ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<ContentPresenter x:Name="CurrentContentPresentationSite" ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> <ContentPresenter.RenderTransform>
<ContentPresenter.RenderTransform> <TransformGroup>
<TransformGroup> <ScaleTransform />
<ScaleTransform /> <SkewTransform />
<SkewTransform /> <RotateTransform />
<RotateTransform /> <TranslateTransform />
<TranslateTransform /> </TransformGroup>
</TransformGroup> </ContentPresenter.RenderTransform>
</ContentPresenter.RenderTransform> </ContentPresenter>
</ContentPresenter> </controls:SimplePanel>
</controls:SimplePanel>
</Border>
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
</Setter> </Setter>