44 files changed
+524
-92
No files matched your search
@@ -63,6 +63,10 @@ Step 4:enjoy coding
|
||||
|
||||
## Latest examples
|
||||
|
||||
### SplitButton
|
||||
|
||||

|
||||
|
||||
### FloatingBlock
|
||||
|
||||

|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<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:system="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:interactivity="clr-namespace:HandyControl.Interactivity">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
@@ -528,7 +527,7 @@
|
||||
|
||||
<!--下拉框扩展样式-->
|
||||
<Style x:Key="ComboBoxExtendBaseStyle" BasedOn="{StaticResource ComboBoxBaseStyle}" TargetType="ComboBox">
|
||||
<Setter Property="Height" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Height" Value="Auto"/>
|
||||
<Setter Property="Template" Value="{StaticResource ComboBoxTopTemplate}"/>
|
||||
<Setter Property="controls:InfoElement.Symbol" Value="●"/>
|
||||
<Setter Property="controls:InfoElement.ContentHeight" Value="{StaticResource DefaultControlHeight}"/>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<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:system="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:interactivity="clr-namespace:HandyControl.Interactivity">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
@@ -486,7 +485,7 @@
|
||||
|
||||
<!--下拉框扩展样式-->
|
||||
<Style x:Key="ComboBoxExtendBaseStyle" BasedOn="{StaticResource ComboBoxBaseStyle}" TargetType="ComboBox">
|
||||
<Setter Property="Height" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Height" Value="Auto"/>
|
||||
<Setter Property="Template" Value="{StaticResource ComboBoxTopTemplate}"/>
|
||||
<Setter Property="controls:InfoElement.Symbol" Value="●"/>
|
||||
<Setter Property="controls:InfoElement.ContentHeight" Value="{StaticResource DefaultControlHeight}"/>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<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:system="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:interactivity="clr-namespace:HandyControl.Interactivity">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
@@ -528,7 +527,7 @@
|
||||
|
||||
<!--下拉框扩展样式-->
|
||||
<Style x:Key="ComboBoxExtendBaseStyle" BasedOn="{StaticResource ComboBoxBaseStyle}" TargetType="ComboBox">
|
||||
<Setter Property="Height" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Height" Value="Auto"/>
|
||||
<Setter Property="Template" Value="{StaticResource ComboBoxTopTemplate}"/>
|
||||
<Setter Property="controls:InfoElement.Symbol" Value="●"/>
|
||||
<Setter Property="controls:InfoElement.ContentHeight" Value="{StaticResource DefaultControlHeight}"/>
|
||||
|
||||
@@ -53,6 +53,16 @@ namespace HandyControlDemo
|
||||
Source = new Uri("pack://application:,,,/HandyControlDemo;component/Resources/Themes/Theme.xaml")
|
||||
});
|
||||
Current.MainWindow?.OnApplyTemplate();
|
||||
|
||||
Resources.MergedDictionaries.Clear();
|
||||
Resources.MergedDictionaries.Add(new ResourceDictionary
|
||||
{
|
||||
Source = new Uri($"pack://application:,,,/HandyControl;component/Themes/Skin{skin.ToString()}.xaml")
|
||||
});
|
||||
Resources.MergedDictionaries.Add(new ResourceDictionary
|
||||
{
|
||||
Source = new Uri("pack://application:,,,/HandyControl;component/Themes/Theme.xaml")
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,6 +116,8 @@
|
||||
|
||||
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);
|
||||
|
||||
@@ -60,7 +60,8 @@ var controlList = new List<string>
|
||||
"HoneycombPanelDemoCtl",
|
||||
"SpriteDemoCtl",
|
||||
"NotificationDemoCtl",
|
||||
"FloatingBlockDemoCtl"
|
||||
"FloatingBlockDemoCtl",
|
||||
"SplitButtonDemoCtl"
|
||||
};
|
||||
var styleList = new List<string>
|
||||
{
|
||||
|
||||
@@ -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>
|
||||
@@ -338,6 +341,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\PaginationDemoViewModel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\SearchBarDemoViewModel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\SideMenuDemoViewModel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\SplitButtonDemoViewModel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\SpriteDemoViewModel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\StepBarDemoViewModel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\TabControlDemoViewModel.cs" />
|
||||
@@ -621,6 +625,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>
|
||||
|
||||
@@ -1401,6 +1401,15 @@ namespace HandyControlDemo.Properties.Langs {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 分割按钮 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string SplitButton {
|
||||
get {
|
||||
return ResourceManager.GetString("SplitButton", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 精灵 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -663,4 +663,7 @@
|
||||
<data name="FloatingBlock" xml:space="preserve">
|
||||
<value>漂浮块</value>
|
||||
</data>
|
||||
<data name="SplitButton" xml:space="preserve">
|
||||
<value>分割按钮</value>
|
||||
</data>
|
||||
</root>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 311 B |
@@ -0,0 +1,39 @@
|
||||
<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:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
||||
xmlns:userControl="clr-namespace:HandyControlDemo.UserControl"
|
||||
DataContext="{Binding SplitButtonDemo,Source={StaticResource Locator}}">
|
||||
<hc:TransitioningContentControl>
|
||||
<StackPanel Margin="32" VerticalAlignment="Center">
|
||||
<hc:SplitButton Margin="0,0,0,10" Content="{x:Static langs:Lang.Default}" Command="{Binding SelectCmd}" CommandParameter="Command0" HorizontalAlignment="Stretch">
|
||||
<hc:SplitButton.DropDownContent>
|
||||
<StackPanel>
|
||||
<MenuItem Header="{x:Static langs:Lang.Title}" Command="{Binding SelectCmd}" CommandParameter="Command1"/>
|
||||
<MenuItem Header="{x:Static langs:Lang.Title}" Command="{Binding SelectCmd}" CommandParameter="Command2"/>
|
||||
<MenuItem Header="{x:Static langs:Lang.Title}" Command="{Binding SelectCmd}" CommandParameter="Command3"/>
|
||||
</StackPanel>
|
||||
</hc:SplitButton.DropDownContent>
|
||||
</hc:SplitButton>
|
||||
<hc:SplitButton Style="{StaticResource SplitButtonPrimary}" Margin="0,0,0,10" Content="{x:Static langs:Lang.Primary}" Command="{Binding SelectCmd}" CommandParameter="Command0" HorizontalAlignment="Stretch">
|
||||
<hc:SplitButton.DropDownContent>
|
||||
<StackPanel>
|
||||
<MenuItem Header="{x:Static langs:Lang.Title}" Command="{Binding SelectCmd}" CommandParameter="Command1"/>
|
||||
<MenuItem Header="{x:Static langs:Lang.Title}" Command="{Binding SelectCmd}" CommandParameter="Command2"/>
|
||||
<MenuItem Header="{x:Static langs:Lang.Title}" Command="{Binding SelectCmd}" CommandParameter="Command3"/>
|
||||
</StackPanel>
|
||||
</hc:SplitButton.DropDownContent>
|
||||
</hc:SplitButton>
|
||||
<hc:SplitButton Style="{StaticResource SplitButtonWarning}" Margin="0,0,0,10" Content="{x:Static langs:Lang.Warning}" HitMode="Hover" HorizontalAlignment="Stretch">
|
||||
<hc:SplitButton.DropDownContent>
|
||||
<StackPanel>
|
||||
<MenuItem Header="{x:Static langs:Lang.Title}" Command="{Binding SelectCmd}" CommandParameter="Command1"/>
|
||||
<MenuItem Header="{x:Static langs:Lang.Title}" Command="{Binding SelectCmd}" CommandParameter="Command2"/>
|
||||
<MenuItem Header="{x:Static langs:Lang.Title}" Command="{Binding SelectCmd}" CommandParameter="Command3"/>
|
||||
</StackPanel>
|
||||
</hc:SplitButton.DropDownContent>
|
||||
</hc:SplitButton>
|
||||
</StackPanel>
|
||||
</hc:TransitioningContentControl>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class SplitButtonDemoCtl
|
||||
{
|
||||
public SplitButtonDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show("123");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"/>
|
||||
@@ -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>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using GalaSoft.MvvmLight;
|
||||
using HandyControl.Controls;
|
||||
#if netle40
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
#else
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
# endif
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class SplitButtonDemoViewModel : ViewModelBase
|
||||
{
|
||||
public RelayCommand<string> SelectCmd => new Lazy<RelayCommand<string>>(() =>
|
||||
new RelayCommand<string>(str => Growl.Info(str))).Value;
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,7 @@ namespace HandyControlDemo.ViewModel
|
||||
SimpleIoc.Default.Register<CardDemoViewModel>();
|
||||
SimpleIoc.Default.Register<SpriteDemoViewModel>();
|
||||
SimpleIoc.Default.Register<NotificationDemoViewModel>();
|
||||
SimpleIoc.Default.Register<SplitButtonDemoViewModel>();
|
||||
}
|
||||
|
||||
public static ViewModelLocator Instance => new Lazy<ViewModelLocator>(() =>
|
||||
@@ -94,6 +95,8 @@ namespace HandyControlDemo.ViewModel
|
||||
|
||||
public NotificationDemoViewModel NotificationDemo => ServiceLocator.Current.GetInstance<NotificationDemoViewModel>();
|
||||
|
||||
public SplitButtonDemoViewModel SplitButtonDemo => ServiceLocator.Current.GetInstance<SplitButtonDemoViewModel>();
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -101,13 +101,13 @@ namespace HandyControl.Controls
|
||||
{
|
||||
if (!(d is UIElement target)) return;
|
||||
|
||||
target.RemoveHandler(PreviewMouseLeftButtonDownEvent, new MouseButtonEventHandler(Target_PreviewMouseLeftButtonDown));
|
||||
target.RemoveHandler(PreviewMouseLeftButtonUpEvent, new MouseButtonEventHandler(Target_PreviewMouseLeftButtonUp));
|
||||
target.PreviewMouseLeftButtonDown -= Target_PreviewMouseLeftButtonDown;
|
||||
target.PreviewMouseLeftButtonUp -= Target_PreviewMouseLeftButtonUp;
|
||||
|
||||
if (e.NewValue != null)
|
||||
{
|
||||
target.AddHandler(PreviewMouseLeftButtonDownEvent, new MouseButtonEventHandler(Target_PreviewMouseLeftButtonDown));
|
||||
target.AddHandler(PreviewMouseLeftButtonUpEvent, new MouseButtonEventHandler(Target_PreviewMouseLeftButtonUp));
|
||||
target.PreviewMouseLeftButtonDown += Target_PreviewMouseLeftButtonDown;
|
||||
target.PreviewMouseLeftButtonUp += Target_PreviewMouseLeftButtonUp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
using HandyControl.Data;
|
||||
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);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty MaxDropDownHeightProperty = DependencyProperty.Register(
|
||||
"MaxDropDownHeight", typeof(double), typeof(SplitButton), new PropertyMetadata(SystemParameters.PrimaryScreenHeight / 3.0));
|
||||
|
||||
public double MaxDropDownHeight
|
||||
{
|
||||
get => (double) GetValue(MaxDropDownHeightProperty);
|
||||
set => SetValue(MaxDropDownHeightProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsDropDownOpenProperty = DependencyProperty.Register(
|
||||
"IsDropDownOpen", typeof(bool), typeof(SplitButton), new PropertyMetadata(ValueBoxes.FalseBox));
|
||||
|
||||
public bool IsDropDownOpen
|
||||
{
|
||||
get => (bool) GetValue(IsDropDownOpenProperty);
|
||||
set => SetValue(IsDropDownOpenProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty DropDownContentProperty = DependencyProperty.Register(
|
||||
"DropDownContent", typeof(object), typeof(SplitButton), new PropertyMetadata(default(object)));
|
||||
|
||||
public object DropDownContent
|
||||
{
|
||||
get => GetValue(DropDownContentProperty);
|
||||
set => SetValue(DropDownContentProperty, value);
|
||||
}
|
||||
|
||||
public SplitButton()
|
||||
{
|
||||
AddHandler(MenuItem.ClickEvent, new RoutedEventHandler(ItemsOnClick));
|
||||
}
|
||||
|
||||
private void ItemsOnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (e.OriginalSource is MenuItem)
|
||||
{
|
||||
SetCurrentValue(IsDropDownOpenProperty, ValueBoxes.FalseBox);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
|
||||
{
|
||||
base.OnPreviewMouseLeftButtonDown(e);
|
||||
|
||||
if (HitMode == MouseHitMode.Hover)
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseEnter(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseEnter(e);
|
||||
|
||||
if (HitMode == MouseHitMode.Hover)
|
||||
{
|
||||
SetCurrentValue(IsDropDownOpenProperty, ValueBoxes.TrueBox);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,7 +147,6 @@ namespace HandyControl.Controls
|
||||
dp._calendarWithClock.Focus();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
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;
|
||||
@@ -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;
|
||||
|
||||
@@ -76,11 +78,28 @@ namespace HandyControl.Controls
|
||||
VisualStateManager.GoToState(this, Transition, true);
|
||||
}
|
||||
|
||||
protected override void OnContentChanged(object oldContent, object newContent)
|
||||
{
|
||||
base.OnContentChanged(oldContent, newContent);
|
||||
public static readonly DependencyProperty ContentProperty = DependencyProperty.Register(
|
||||
"Content", typeof(object), typeof(TransitioningContentControl), new PropertyMetadata(default(object), OnContentChanged));
|
||||
|
||||
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.")]
|
||||
|
||||
@@ -132,11 +132,8 @@ namespace HandyControl.Controls
|
||||
set => SetValue(IsReadOnlyProperty, value);
|
||||
}
|
||||
|
||||
private void RateItemValueChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Value =
|
||||
(from RateItem item in Items where item.IsSelected select item.IsHalf ? 0.5 : 1).Sum();
|
||||
}
|
||||
private void RateItemValueChanged(object sender, RoutedEventArgs e) =>
|
||||
Value = (from RateItem item in Items where item.IsSelected select item.IsHalf ? 0.5 : 1).Sum();
|
||||
|
||||
private void RateItemSelectedChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
@@ -163,15 +160,9 @@ namespace HandyControl.Controls
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool IsItemItsOwnContainerOverride(object item)
|
||||
{
|
||||
return item is RateItem;
|
||||
}
|
||||
protected override bool IsItemItsOwnContainerOverride(object item) => item is RateItem;
|
||||
|
||||
protected override DependencyObject GetContainerForItemOverride()
|
||||
{
|
||||
return new RateItem();
|
||||
}
|
||||
protected override DependencyObject GetContainerForItemOverride() => new RateItem();
|
||||
|
||||
private void OnApplyTemplateInternal()
|
||||
{
|
||||
@@ -242,9 +233,6 @@ namespace HandyControl.Controls
|
||||
}
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
Value = DefaultValue;
|
||||
}
|
||||
public void Reset() => Value = DefaultValue;
|
||||
}
|
||||
}
|
||||
@@ -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\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" />
|
||||
@@ -34,13 +35,16 @@
|
||||
<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)Data\Enum\NotifyIconInfoType.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\CloseWindowCommand.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\OpenLinkCommand.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\BorderCircularClipConverter.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\CornerRadiusSplitConverter.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\Number2PercentageConverter.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\RectangleCircularConverter.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\ThicknessSplitConverter.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Extension\FrameworkElementExtension.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Extension\StringExtension.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Extension\ValueExtension.cs" />
|
||||
@@ -391,6 +395,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>
|
||||
@@ -779,6 +787,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>
|
||||
@@ -851,4 +863,10 @@
|
||||
<ItemGroup>
|
||||
<Folder Include="$(MSBuildThisFileDirectory)Controls\Growl\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="E:\Work\GitHub\HandyControl\src\Shared\HandyControl_Shared\Themes\Styles\Base\SplitButtonBaseStyle.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -20,5 +20,7 @@
|
||||
<converter:Object2VisibilityConverter x:Key="Object2VisibilityConverter"/>
|
||||
<converter:Number2PercentageConverter x:Key="Number2PercentageConverter"/>
|
||||
<converter:RectangleCircularConverter x:Key="RectangleCircularConverter"/>
|
||||
<converter:ThicknessSplitConverter x:Key="ThicknessSplitConverter"/>
|
||||
<converter:CornerRadiusSplitConverter x:Key="CornerRadiusSplitConverter"/>
|
||||
<MenuScrollingVisibilityConverter x:Key="MenuScrollingVisibilityConverter" />
|
||||
</ResourceDictionary>
|
||||
@@ -1,7 +1,6 @@
|
||||
<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:system="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:interactivity="clr-namespace:HandyControl.Interactivity">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
@@ -183,13 +182,13 @@
|
||||
</ControlTemplate>
|
||||
|
||||
<Style x:Key="DatePickerExtendBaseStyle" BasedOn="{StaticResource DatePickerBaseStyle}" TargetType="DatePicker">
|
||||
<Setter Property="Height" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Height" Value="Auto"/>
|
||||
<Setter Property="controls:InfoElement.Symbol" Value="●"/>
|
||||
<Setter Property="Template" Value="{StaticResource DatePickerExtendTopTemplate}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="controls:InfoElement.TitleAlignment" Value="Left">
|
||||
<Setter Property="Template" Value="{StaticResource DatePickerExtendLeftTemplate}"/>
|
||||
<Setter Property="Width" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Width" Value="Auto"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
@@ -351,7 +350,7 @@
|
||||
<Style.Triggers>
|
||||
<Trigger Property="controls:InfoElement.TitleAlignment" Value="Left">
|
||||
<Setter Property="Template" Value="{StaticResource DatePickerPlusLeftTemplate}"/>
|
||||
<Setter Property="Width" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Width" Value="Auto"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<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:system="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:interactivity="clr-namespace:HandyControl.Interactivity">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
@@ -162,13 +161,13 @@
|
||||
</ControlTemplate>
|
||||
|
||||
<Style x:Key="DateTimePickerExtendBaseStyle" BasedOn="{StaticResource DateTimePickerBaseStyle}" TargetType="controls:DateTimePicker">
|
||||
<Setter Property="Height" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Height" Value="Auto"/>
|
||||
<Setter Property="controls:InfoElement.Symbol" Value="●"/>
|
||||
<Setter Property="Template" Value="{StaticResource DateTimePickerExtendTopTemplate}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="controls:InfoElement.TitleAlignment" Value="Left">
|
||||
<Setter Property="Template" Value="{StaticResource DateTimePickerExtendLeftTemplate}"/>
|
||||
<Setter Property="Width" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Width" Value="Auto"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
@@ -330,7 +329,7 @@
|
||||
<Style.Triggers>
|
||||
<Trigger Property="controls:InfoElement.TitleAlignment" Value="Left">
|
||||
<Setter Property="Template" Value="{StaticResource DateTimePickerPlusLeftTemplate}"/>
|
||||
<Setter Property="Width" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Width" Value="Auto"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
@@ -1,8 +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:interactivity="clr-namespace:HandyControl.Interactivity"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
xmlns:interactivity="clr-namespace:HandyControl.Interactivity">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../Basic/Geometries.xaml"/>
|
||||
@@ -131,12 +130,12 @@
|
||||
<Style x:Key="NumericUpDownExtendBaseStyle" BasedOn="{StaticResource NumericUpDownBaseStyle}" TargetType="controls:NumericUpDown">
|
||||
<Setter Property="controls:InfoElement.Symbol" Value="●"/>
|
||||
<Setter Property="controls:InfoElement.ContentHeight" Value="{StaticResource DefaultControlHeight}"/>
|
||||
<Setter Property="Height" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Height" Value="Auto"/>
|
||||
<Setter Property="Template" Value="{StaticResource NumericUpDownExtendTopTemplate}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="controls:InfoElement.TitleAlignment" Value="Left">
|
||||
<Setter Property="Template" Value="{StaticResource NumericUpDownExtendLeftTemplate}"/>
|
||||
<Setter Property="Width" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Width" Value="Auto"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
@@ -270,7 +269,7 @@
|
||||
<Style.Triggers>
|
||||
<Trigger Property="controls:InfoElement.TitleAlignment" Value="Left">
|
||||
<Setter Property="Template" Value="{StaticResource NumericUpDownPlusLeftTemplate}"/>
|
||||
<Setter Property="Width" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Width" Value="Auto"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<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:system="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:interactivity="clr-namespace:HandyControl.Interactivity">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
@@ -115,7 +114,7 @@
|
||||
</ControlTemplate>
|
||||
|
||||
<Style x:Key="PasswordBoxExtendBaseStyle" BasedOn="{StaticResource PasswordBoxBaseStyle}" TargetType="PasswordBox">
|
||||
<Setter Property="Height" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Height" Value="Auto"/>
|
||||
<Setter Property="controls:InfoElement.Symbol" Value="●"/>
|
||||
<Setter Property="controls:InfoElement.ContentHeight" Value="{StaticResource DefaultControlHeight}"/>
|
||||
<Setter Property="controls:PasswordBoxAttach.IsMonitoring" Value="True"/>
|
||||
@@ -123,7 +122,7 @@
|
||||
<Style.Triggers>
|
||||
<Trigger Property="controls:InfoElement.TitleAlignment" Value="Left">
|
||||
<Setter Property="Template" Value="{StaticResource PasswordBoxExtendLeftTemplate}"/>
|
||||
<Setter Property="Width" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Width" Value="Auto"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
@@ -291,7 +290,7 @@
|
||||
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
|
||||
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Height" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Height" Value="Auto"/>
|
||||
<Setter Property="Padding" Value="{StaticResource DefaultInputPadding}"/>
|
||||
<Setter Property="controls:InfoElement.Symbol" Value="●"/>
|
||||
<Setter Property="controls:InfoElement.ContentHeight" Value="{StaticResource DefaultControlHeight}"/>
|
||||
@@ -301,7 +300,7 @@
|
||||
<Style.Triggers>
|
||||
<Trigger Property="controls:InfoElement.TitleAlignment" Value="Left">
|
||||
<Setter Property="Template" Value="{StaticResource PasswordBoxPlusLeftTemplate}"/>
|
||||
<Setter Property="Width" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Width" Value="Auto"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<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:system="clr-namespace:System;assembly=mscorlib">
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ToggleButtonBaseStyle.xaml"/>
|
||||
@@ -32,7 +31,7 @@
|
||||
<ControlTemplate TargetType="controls:ProgressButton">
|
||||
<Border x:Name="Chrome" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
|
||||
<controls:SimplePanel>
|
||||
<ProgressBar x:Name="ProgressBar" Height="{x:Static system:Double.NaN}" Value="{TemplateBinding Progress}" Maximum="100" Visibility="Collapsed" Style="{TemplateBinding ProgressStyle}"/>
|
||||
<ProgressBar x:Name="ProgressBar" Height="Auto" Value="{TemplateBinding Progress}" Maximum="100" Visibility="Collapsed" Style="{TemplateBinding ProgressStyle}"/>
|
||||
<ContentPresenter Name="UnCheckedElement" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
<ContentPresenter Name="CheckedElement" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Visibility="Collapsed" Content="{Binding Path=(controls:StatusSwitchElement.CheckedElement),RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||
</controls:SimplePanel>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<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:system="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:interactivity="clr-namespace:HandyControl.Interactivity">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
@@ -109,13 +108,13 @@
|
||||
</ControlTemplate>
|
||||
|
||||
<Style x:Key="SearchBarExtendBaseStyle" BasedOn="{StaticResource SearchBarBaseStyle}" TargetType="controls:SearchBar">
|
||||
<Setter Property="Height" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Height" Value="Auto"/>
|
||||
<Setter Property="controls:InfoElement.Symbol" Value="●"/>
|
||||
<Setter Property="Template" Value="{StaticResource SearchBarExtendTopTemplate}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="controls:InfoElement.TitleAlignment" Value="Left">
|
||||
<Setter Property="Template" Value="{StaticResource SearchBarExtendLeftTemplate}"/>
|
||||
<Setter Property="Width" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Width" Value="Auto"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
@@ -249,7 +248,7 @@
|
||||
<Style.Triggers>
|
||||
<Trigger Property="controls:InfoElement.TitleAlignment" Value="Left">
|
||||
<Setter Property="Template" Value="{StaticResource SearchBarPlusLeftTemplate}"/>
|
||||
<Setter Property="Width" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Width" Value="Auto"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
<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="MenuBaseStyle.xaml"/>
|
||||
<ResourceDictionary Source="../ToggleButton.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style x:Key="SplitButtonBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="controls:SplitButton">
|
||||
<Setter Property="Height" Value="{StaticResource DefaultControlHeight}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="Padding" Value="{StaticResource DefaultControlPadding}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:SplitButton">
|
||||
<controls:SimplePanel x:Name="templateRoot">
|
||||
<Border Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||
<Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}">
|
||||
<Path x:Name="PathMain" Width="{TemplateBinding controls:IconElement.Width}" Height="{TemplateBinding controls:IconElement.Height}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding controls:IconElement.Geometry}"/>
|
||||
<ContentPresenter x:Name="ContentPresenterMain" RecognizesAccessKey="True" VerticalAlignment="Center" Margin="6,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</StackPanel>
|
||||
<ToggleButton x:Name="PART_Arrow" Foreground="{TemplateBinding Foreground}" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Width="22" Height="Auto" Padding="0,10,8,10" HorizontalContentAlignment="Left" Grid.Column="1" Style="{StaticResource ToggleButtonIconTransparent}" controls:IconSwitchElement.GeometrySelected="{StaticResource UpGeometry}" controls:IconElement.Geometry="{StaticResource DownGeometry}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Popup AllowsTransparency="true" StaysOpen="False" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" PopupAnimation="Fade" Placement="Bottom">
|
||||
<Border CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="dropDownBorder" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{Binding ActualWidth, ElementName=templateRoot}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Background="{DynamicResource RegionBrush}">
|
||||
<ScrollViewer Margin="0,4" x:Name="DropDownScrollViewer">
|
||||
<controls:SimplePanel RenderOptions.ClearTypeHint="Enabled">
|
||||
<Canvas HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
|
||||
<Rectangle x:Name="opaqueRect" Fill="{Binding Background, ElementName=dropDownBorder}" Height="{Binding ActualHeight, ElementName=dropDownBorder}" Width="{Binding ActualWidth, ElementName=dropDownBorder}"/>
|
||||
</Canvas>
|
||||
<ContentPresenter ContentSource="DropDownContent"/>
|
||||
</controls:SimplePanel>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Popup>
|
||||
</controls:SimplePanel>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Content" Value="{x:Null}">
|
||||
<Setter Property="Visibility" Value="Collapsed" TargetName="ContentPresenterMain"/>
|
||||
</Trigger>
|
||||
<Trigger Property="controls:IconElement.Geometry" Value="{x:Null}">
|
||||
<Setter Property="Visibility" Value="Collapsed" TargetName="PathMain"/>
|
||||
<Setter Property="Margin" Value="0" TargetName="ContentPresenterMain"/>
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="HitMode" Value="Click"/>
|
||||
<Condition Property="IsChecked" Value="True" SourceName="PART_Arrow"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="IsDropDownOpen" Value="True"/>
|
||||
</MultiTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Opacity" Value=".9"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Opacity" Value=".6"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value="0.4"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -1,7 +1,6 @@
|
||||
<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:system="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:interactivity="clr-namespace:HandyControl.Interactivity">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
@@ -130,12 +129,12 @@
|
||||
<Style x:Key="TextBoxExtendBaseStyle" BasedOn="{StaticResource TextBoxBaseStyle}" TargetType="TextBox">
|
||||
<Setter Property="controls:InfoElement.Symbol" Value="●"/>
|
||||
<Setter Property="controls:InfoElement.ContentHeight" Value="{StaticResource DefaultControlHeight}"/>
|
||||
<Setter Property="Height" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Height" Value="Auto"/>
|
||||
<Setter Property="Template" Value="{StaticResource TextBoxExtendTopTemplate}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="controls:InfoElement.TitleAlignment" Value="Left">
|
||||
<Setter Property="Template" Value="{StaticResource TextBoxExtendLeftTemplate}"/>
|
||||
<Setter Property="Width" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Width" Value="Auto"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
@@ -265,7 +264,7 @@
|
||||
<Style.Triggers>
|
||||
<Trigger Property="controls:InfoElement.TitleAlignment" Value="Left">
|
||||
<Setter Property="Template" Value="{StaticResource TextBoxPlusLeftTemplate}"/>
|
||||
<Setter Property="Width" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Width" Value="Auto"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<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:system="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:interactivity="clr-namespace:HandyControl.Interactivity">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
@@ -162,13 +161,13 @@
|
||||
</ControlTemplate>
|
||||
|
||||
<Style x:Key="TimePickerExtendBaseStyle" BasedOn="{StaticResource TimePickerBaseStyle}" TargetType="controls:TimePicker">
|
||||
<Setter Property="Height" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Height" Value="Auto"/>
|
||||
<Setter Property="controls:InfoElement.Symbol" Value="●"/>
|
||||
<Setter Property="Template" Value="{StaticResource TimePickerExtendTopTemplate}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="controls:InfoElement.TitleAlignment" Value="Left">
|
||||
<Setter Property="Template" Value="{StaticResource TimePickerExtendLeftTemplate}"/>
|
||||
<Setter Property="Width" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Width" Value="Auto"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
@@ -330,7 +329,7 @@
|
||||
<Style.Triggers>
|
||||
<Trigger Property="controls:InfoElement.TitleAlignment" Value="Left">
|
||||
<Setter Property="Template" Value="{StaticResource TimePickerPlusLeftTemplate}"/>
|
||||
<Setter Property="Width" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="Width" Value="Auto"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<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/SplitButtonBaseStyle.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style BasedOn="{StaticResource SplitButtonBaseStyle}" TargetType="controls:SplitButton">
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Style.Triggers>
|
||||
<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>
|
||||
|
||||
<Style x:Key="SplitButtonPrimary" BasedOn="{StaticResource SplitButtonBaseStyle}" TargetType="controls:SplitButton">
|
||||
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="SplitButtonSuccess" BasedOn="{StaticResource SplitButtonBaseStyle}" TargetType="controls:SplitButton">
|
||||
<Setter Property="Background" Value="{DynamicResource SuccessBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="SplitButtonInfo" BasedOn="{StaticResource SplitButtonBaseStyle}" TargetType="controls:SplitButton">
|
||||
<Setter Property="Background" Value="{DynamicResource InfoBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="SplitButtonWarning" BasedOn="{StaticResource SplitButtonBaseStyle}" TargetType="controls:SplitButton">
|
||||
<Setter Property="Background" Value="{DynamicResource WarningBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="SplitButtonDanger" BasedOn="{StaticResource SplitButtonBaseStyle}" TargetType="controls:SplitButton">
|
||||
<Setter Property="Background" Value="{DynamicResource DangerBrush}"/>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -74,6 +74,7 @@
|
||||
<ResourceDictionary Source="Sprite.xaml"/>
|
||||
<ResourceDictionary Source="Notification.xaml"/>
|
||||
<ResourceDictionary Source="FloatingBlock.xaml"/>
|
||||
<ResourceDictionary Source="SplitButton.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -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">
|
||||
@@ -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>
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace HandyControl.Tools.Converter
|
||||
{
|
||||
public class CornerRadiusSplitConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is CornerRadius cornerRadius)
|
||||
{
|
||||
if (parameter is string str)
|
||||
{
|
||||
var arr = str.Split(',');
|
||||
if (arr.Length != 4) return cornerRadius;
|
||||
|
||||
return new CornerRadius(arr[0].Equals("1") ? cornerRadius.TopLeft : 0,
|
||||
arr[1].Equals("1") ? cornerRadius.TopRight : 0,
|
||||
arr[1].Equals("1") ? cornerRadius.BottomRight : 0,
|
||||
arr[1].Equals("1") ? cornerRadius.BottomLeft : 0);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace HandyControl.Tools.Converter
|
||||
{
|
||||
public class ThicknessSplitConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is Thickness cornerRadius)
|
||||
{
|
||||
if (parameter is string str)
|
||||
{
|
||||
var arr = str.Split(',');
|
||||
if (arr.Length != 4) return cornerRadius;
|
||||
|
||||
return new CornerRadius(arr[0].Equals("1") ? cornerRadius.Left : 0,
|
||||
arr[1].Equals("1") ? cornerRadius.Top : 0,
|
||||
arr[1].Equals("1") ? cornerRadius.Right : 0,
|
||||
arr[1].Equals("1") ? cornerRadius.Bottom : 0);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user