Skip to content

Commit

Permalink
init branch
Browse files Browse the repository at this point in the history
  • Loading branch information
NaBian committed Sep 3, 2019
1 parent 5a1bed8 commit a54fc69
Show file tree
Hide file tree
Showing 23 changed files with 169 additions and 30 deletions.
Expand Up @@ -417,6 +417,9 @@
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\thumbs_up.png">
<Link>Resources\Img\thumbs_up.png</Link>
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\SplitButton_16x.png">
<Link>Resources\Img\SplitButton_16x.png</Link>
</Resource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\Lang.en.resx">
Expand Down
Expand Up @@ -429,6 +429,9 @@
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>MessageToken.cs</LastGenOutput>
</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">
<Link>Resources\Img\LeftMainContent\thumbs_up.png</Link>
</Resource>
Expand Down
Expand Up @@ -492,6 +492,9 @@
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>MessageToken.cs</LastGenOutput>
</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">
<Link>Resources\Img\LeftMainContent\thumbs_up.png</Link>
</Resource>
Expand Down
2 changes: 2 additions & 0 deletions src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs
Expand Up @@ -116,6 +116,8 @@ public class MessageToken

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 RepeatButtonDemoCtl = nameof(RepeatButtonDemoCtl);
Expand Down
3 changes: 2 additions & 1 deletion src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt
Expand Up @@ -60,7 +60,8 @@ var controlList = new List<string>
"HoneycombPanelDemoCtl",
"SpriteDemoCtl",
"NotificationDemoCtl",
"FloatingBlockDemoCtl"
"FloatingBlockDemoCtl",
"SplitButtonDemoCtl"
};
var styleList = new List<string>
{
Expand Down
Expand Up @@ -183,6 +183,9 @@
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\SideMenuDemoCtl.xaml.cs">
<DependentUpon>SideMenuDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\SplitButtonDemoCtl.xaml.cs">
<DependentUpon>SplitButtonDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\SpriteDemoCtl.xaml.cs">
<DependentUpon>SpriteDemoCtl.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -621,6 +624,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\SplitButtonDemoCtl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\SpriteDemoCtl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -663,4 +663,7 @@
<data name="FloatingBlock" xml:space="preserve">
<value>FloatingBlock</value>
</data>
<data name="SplitButton" xml:space="preserve">
<value>SplitButton</value>
</data>
</root>
Expand Up @@ -663,4 +663,7 @@
<data name="FloatingBlock" xml:space="preserve">
<value>FloatingBlock</value>
</data>
<data name="SplitButton" xml:space="preserve">
<value>SplitButton</value>
</data>
</root>
Expand Up @@ -663,4 +663,7 @@
<data name="FloatingBlock" xml:space="preserve">
<value>FloatingBlock</value>
</data>
<data name="SplitButton" xml:space="preserve">
<value>SplitButton</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
Expand Up @@ -663,4 +663,7 @@
<data name="FloatingBlock" xml:space="preserve">
<value>漂浮块</value>
</data>
<data name="SplitButton" xml:space="preserve">
<value>分割按钮</value>
</data>
</root>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -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();
}
}
}
Expand Up @@ -225,6 +225,11 @@
<Image Source="../../Resources/Img/LeftMainContent/GoToTop_16x.png"/>
</hc:EdgeElement.LeftContent>
</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}">
<hc:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/LeftMainContent/ButtonGroup_16x.png"/>
Expand Down Expand Up @@ -330,7 +335,7 @@
<Image Source="../../Resources/Img/LeftMainContent/TextBlock_16x.png"/>
</hc:EdgeElement.LeftContent>
</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>
<Image Source="../../Resources/Img/LeftMainContent/Dynamic_16x.png"/>
</hc:EdgeElement.LeftContent>
Expand Down
18 changes: 18 additions & 0 deletions src/Shared/HandyControl_Shared/Controls/Button/SplitButton.cs
@@ -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);
}
}
}
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using System.Windows.Media.Animation;
using HandyControl.Data;
using HandyControl.Tools;
Expand All @@ -14,7 +15,8 @@ namespace HandyControl.Controls
[TemplateVisualState(GroupName = PresentationGroup, Name = DefaultTransitionState)]
[TemplatePart(Name = PreviousContentPresentationSitePartName, Type = typeof(ContentControl))]
[TemplatePart(Name = CurrentContentPresentationSitePartName, Type = typeof(ContentControl))]
public class TransitioningContentControl : ContentControl
[ContentProperty("Content")]
public class TransitioningContentControl : Control
{
private Storyboard _currentTransition;

Expand Down Expand Up @@ -76,11 +78,28 @@ public override void OnApplyTemplate()
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));

private static void OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
base.OnContentChanged(oldContent, newContent);
var ctl = (TransitioningContentControl) d;
ctl.StartTransition(e.OldValue, e.NewValue);
}

StartTransition(oldContent, newContent);
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.")]
Expand Down
8 changes: 8 additions & 0 deletions src/Shared/HandyControl_Shared/Data/Enum/MouseHitMode.cs
@@ -0,0 +1,8 @@
namespace HandyControl.Data.Enum
{
public enum MouseHitMode
{
Click,
Hover
}
}
10 changes: 10 additions & 0 deletions src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
Expand Up @@ -21,6 +21,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\RectangleAttach.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\TextBlockAttach.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\Image\ImageBlock.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Magnifier.cs" />
Expand All @@ -34,6 +35,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\RangeThumb.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\TwoWayRangeBase.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)Interactivity\Commands\CloseWindowCommand.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\OpenLinkCommand.cs" />
Expand Down Expand Up @@ -390,6 +392,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</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">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -778,6 +784,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\SplitButton.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Sprite.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down
@@ -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>
10 changes: 10 additions & 0 deletions src/Shared/HandyControl_Shared/Themes/Styles/SplitButton.xaml
@@ -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>
1 change: 1 addition & 0 deletions src/Shared/HandyControl_Shared/Themes/Styles/Style.xaml
Expand Up @@ -74,6 +74,7 @@
<ResourceDictionary Source="Sprite.xaml"/>
<ResourceDictionary Source="Notification.xaml"/>
<ResourceDictionary Source="FloatingBlock.xaml"/>
<ResourceDictionary Source="SplitButton.xaml"/>
</ResourceDictionary.MergedDictionaries>

</ResourceDictionary>
Expand Up @@ -11,7 +11,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:TransitioningContentControl">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2">
<controls:SimplePanel>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="PresentationStates">
<VisualState x:Name="DefaultTransition">
Expand Down Expand Up @@ -76,29 +76,27 @@
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<controls:SimplePanel>
<ContentPresenter x:Name="PreviousContentPresentationSite" Content="{x:Null}" ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<ContentPresenter.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform />
<TranslateTransform />
</TransformGroup>
</ContentPresenter.RenderTransform>
</ContentPresenter>
<ContentPresenter x:Name="CurrentContentPresentationSite" ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<ContentPresenter.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform />
<TranslateTransform />
</TransformGroup>
</ContentPresenter.RenderTransform>
</ContentPresenter>
</controls:SimplePanel>
</Border>
<ContentPresenter x:Name="PreviousContentPresentationSite" Content="{x:Null}" ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<ContentPresenter.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform />
<TranslateTransform />
</TransformGroup>
</ContentPresenter.RenderTransform>
</ContentPresenter>
<ContentPresenter x:Name="CurrentContentPresentationSite" ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<ContentPresenter.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform />
<TranslateTransform />
</TransformGroup>
</ContentPresenter.RenderTransform>
</ContentPresenter>
</controls:SimplePanel>
</ControlTemplate>
</Setter.Value>
</Setter>
Expand Down

0 comments on commit a54fc69

Please sign in to comment.