update to v1.2.0
This commit is contained in:
1 parent
c402f428fb
commit
4afd1097de
90 files changed
+2992
-1652
No files matched your search
@@ -0,0 +1,188 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class AnimationPath : Shape
|
||||
{
|
||||
private bool _isLoaded;
|
||||
|
||||
/// <summary>
|
||||
/// 故事版
|
||||
/// </summary>
|
||||
private Storyboard _storyboard;
|
||||
|
||||
/// <summary>
|
||||
/// 路径
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty DataProperty = DependencyProperty.Register(nameof(Data),
|
||||
typeof(Geometry), typeof(AnimationPath), new FrameworkPropertyMetadata(null,
|
||||
OnPropertiesChanged));
|
||||
|
||||
private static void OnPropertiesChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is AnimationPath path)
|
||||
{
|
||||
path.UpdatePath();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 路径
|
||||
/// </summary>
|
||||
public Geometry Data
|
||||
{
|
||||
get => (Geometry)GetValue(DataProperty);
|
||||
set => SetValue(DataProperty, value);
|
||||
}
|
||||
|
||||
protected override Geometry DefiningGeometry => Data ?? Geometry.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 路径长度
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty PathLengthProperty = DependencyProperty.Register(
|
||||
"PathLength", typeof(double), typeof(AnimationPath), new FrameworkPropertyMetadata(default(double),
|
||||
OnPropertiesChanged));
|
||||
|
||||
/// <summary>
|
||||
/// 路径长度
|
||||
/// </summary>
|
||||
public double PathLength
|
||||
{
|
||||
get => (double)GetValue(PathLengthProperty);
|
||||
set => SetValue(PathLengthProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 动画间隔时间
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty DurationProperty = DependencyProperty.Register(
|
||||
"Duration", typeof(Duration), typeof(AnimationPath), new FrameworkPropertyMetadata(new Duration(TimeSpan.FromSeconds(2)),
|
||||
OnPropertiesChanged));
|
||||
|
||||
/// <summary>
|
||||
/// 动画间隔时间
|
||||
/// </summary>
|
||||
public Duration Duration
|
||||
{
|
||||
get => (Duration)GetValue(DurationProperty);
|
||||
set => SetValue(DurationProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsPlayingProperty = DependencyProperty.Register(
|
||||
"IsPlaying", typeof(bool), typeof(AnimationPath), new FrameworkPropertyMetadata(true, (o, args) =>
|
||||
{
|
||||
var ctl = (AnimationPath)o;
|
||||
var v = (bool)args.NewValue;
|
||||
if (v)
|
||||
{
|
||||
ctl.UpdatePath();
|
||||
}
|
||||
else
|
||||
{
|
||||
ctl._storyboard?.Pause();
|
||||
}
|
||||
}));
|
||||
|
||||
/// <summary>
|
||||
/// 是否正在播放动画
|
||||
/// </summary>
|
||||
public bool IsPlaying
|
||||
{
|
||||
get => (bool)GetValue(IsPlayingProperty);
|
||||
set => SetValue(IsPlayingProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty RepeatBehaviorProperty = DependencyProperty.Register(
|
||||
"RepeatBehavior", typeof(RepeatBehavior), typeof(AnimationPath), new PropertyMetadata(RepeatBehavior.Forever));
|
||||
|
||||
/// <summary>
|
||||
/// 动画重复行为
|
||||
/// </summary>
|
||||
public RepeatBehavior RepeatBehavior
|
||||
{
|
||||
get => (RepeatBehavior)GetValue(RepeatBehaviorProperty);
|
||||
set => SetValue(RepeatBehaviorProperty, value);
|
||||
}
|
||||
|
||||
static AnimationPath()
|
||||
{
|
||||
StretchProperty.AddOwner(typeof(AnimationPath), new FrameworkPropertyMetadata(Stretch.Uniform,
|
||||
OnPropertiesChanged));
|
||||
|
||||
StrokeThicknessProperty.AddOwner(typeof(AnimationPath), new FrameworkPropertyMetadata(1.0,
|
||||
OnPropertiesChanged));
|
||||
}
|
||||
|
||||
public AnimationPath()
|
||||
{
|
||||
Loaded += (s, e) =>
|
||||
{
|
||||
if (_isLoaded) return;
|
||||
UpdatePath();
|
||||
_isLoaded = true;
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 动画完成事件
|
||||
/// </summary>
|
||||
public static readonly RoutedEvent CompletedEvent =
|
||||
EventManager.RegisterRoutedEvent("Completed", RoutingStrategy.Bubble,
|
||||
typeof(EventHandler), typeof(AnimationPath));
|
||||
|
||||
/// <summary>
|
||||
/// 动画完成事件
|
||||
/// </summary>
|
||||
public event EventHandler Completed
|
||||
{
|
||||
add => AddHandler(CompletedEvent, value);
|
||||
remove => RemoveHandler(CompletedEvent, value);
|
||||
}
|
||||
|
||||
private void UpdatePath()
|
||||
{
|
||||
if (!Duration.HasTimeSpan || !IsPlaying) return;
|
||||
StrokeDashOffset = PathLength;
|
||||
StrokeDashArray = new DoubleCollection(new List<double>
|
||||
{
|
||||
PathLength,
|
||||
PathLength
|
||||
});
|
||||
|
||||
//定义动画
|
||||
_storyboard = new Storyboard
|
||||
{
|
||||
RepeatBehavior = RepeatBehavior
|
||||
};
|
||||
_storyboard.Completed += (s, e) => RaiseEvent(new RoutedEventArgs(CompletedEvent));
|
||||
|
||||
var frames = new DoubleAnimationUsingKeyFrames();
|
||||
//开始位置
|
||||
var frame0 = new LinearDoubleKeyFrame
|
||||
{
|
||||
Value = PathLength,
|
||||
KeyTime = KeyTime.FromTimeSpan(TimeSpan.Zero)
|
||||
};
|
||||
//结束位置
|
||||
var frame1 = new LinearDoubleKeyFrame
|
||||
{
|
||||
Value = -PathLength,
|
||||
KeyTime = KeyTime.FromTimeSpan(Duration.TimeSpan)
|
||||
};
|
||||
frames.KeyFrames.Add(frame0);
|
||||
frames.KeyFrames.Add(frame1);
|
||||
|
||||
Storyboard.SetTarget(frames, this);
|
||||
Storyboard.SetTargetProperty(frames, new PropertyPath(StrokeDashOffsetProperty));
|
||||
_storyboard.Children.Add(frames);
|
||||
|
||||
_storyboard.Begin();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class BackgroundSwitchElement : DependencyObject
|
||||
{
|
||||
public static readonly DependencyProperty MouseHoverBackgroundProperty = DependencyProperty.RegisterAttached(
|
||||
"MouseHoverBackground", typeof(Brush), typeof(BackgroundSwitchElement), new PropertyMetadata(Brushes.Transparent));
|
||||
|
||||
public static void SetMouseHoverBackground(DependencyObject element, Brush value)
|
||||
{
|
||||
element.SetValue(MouseHoverBackgroundProperty, value);
|
||||
}
|
||||
|
||||
public static Brush GetMouseHoverBackground(DependencyObject element)
|
||||
{
|
||||
return (Brush)element.GetValue(MouseHoverBackgroundProperty);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty MouseDownBackgroundProperty = DependencyProperty.RegisterAttached(
|
||||
"MouseDownBackground", typeof(Brush), typeof(BackgroundSwitchElement), new PropertyMetadata(Brushes.Transparent));
|
||||
|
||||
public static void SetMouseDownBackground(DependencyObject element, Brush value)
|
||||
{
|
||||
element.SetValue(MouseDownBackgroundProperty, value);
|
||||
}
|
||||
|
||||
public static Brush GetMouseDownBackground(DependencyObject element)
|
||||
{
|
||||
return (Brush)element.GetValue(MouseDownBackgroundProperty);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Windows;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class BorderElement : DependencyObject
|
||||
{
|
||||
public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.RegisterAttached(
|
||||
"CornerRadius", typeof(CornerRadius), typeof(BorderElement), new PropertyMetadata(default(CornerRadius)));
|
||||
|
||||
public static void SetCornerRadius(DependencyObject element, CornerRadius value)
|
||||
{
|
||||
element.SetValue(CornerRadiusProperty, value);
|
||||
}
|
||||
|
||||
public static CornerRadius GetCornerRadius(DependencyObject element)
|
||||
{
|
||||
return (CornerRadius) element.GetValue(CornerRadiusProperty);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -75,24 +75,6 @@
|
||||
<TextBlock Foreground="{StaticResource ThirdlyTextBrush}" Margin="0,6,0,0" FontSize="10" Text="A" HorizontalAlignment="Center"></TextBlock>
|
||||
</StackPanel>
|
||||
</UniformGrid>
|
||||
<!--<UniformGrid Visibility="{Binding ShowList[2],ElementName=UserControlMain,Converter={StaticResource Boolean2VisibilityConverter}}" Rows="1" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="-2,14,-2,0" VerticalAlignment="Top">
|
||||
<StackPanel Margin="2,0">
|
||||
<controls:InfoTextBox TextPadding="0" Text="{Binding ColorInfoList[5],ElementName=UserControlMain}" FontSize="10" ShowSmallCornerRadius="True" MaxLength="3" ShowClearButton="False" HorizontalTextAlignment="Center" IsNeedly="False" Height="24" ></controls:InfoTextBox>
|
||||
<TextBlock Foreground="{StaticResource ThirdlyTextBrush}" Margin="0,6,0,0" FontSize="10" Text="H" HorizontalAlignment="Center"></TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="2,0">
|
||||
<controls:InfoTextBox TextPadding="0" Text="{Binding ColorInfoList[6],ElementName=UserControlMain}" FontSize="10" ShowSmallCornerRadius="True" MaxLength="3" ShowClearButton="False" HorizontalTextAlignment="Center" IsNeedly="False" Height="24" ></controls:InfoTextBox>
|
||||
<TextBlock Foreground="{StaticResource ThirdlyTextBrush}" Margin="0,6,0,0" FontSize="10" Text="S" HorizontalAlignment="Center"></TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="2,0">
|
||||
<controls:InfoTextBox TextPadding="0" Text="{Binding ColorInfoList[7],ElementName=UserControlMain}" FontSize="10" ShowSmallCornerRadius="True" MaxLength="3" ShowClearButton="False" HorizontalTextAlignment="Center" IsNeedly="False" Height="24" ></controls:InfoTextBox>
|
||||
<TextBlock Foreground="{StaticResource ThirdlyTextBrush}" Margin="0,6,0,0" FontSize="10" Text="L" HorizontalAlignment="Center"></TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="2,0">
|
||||
<controls:InfoTextBox TextPadding="0" Text="{Binding ColorInfoList[8],ElementName=UserControlMain}" FontSize="10" ShowSmallCornerRadius="True" MaxLength="3" ShowClearButton="False" HorizontalTextAlignment="Center" IsNeedly="False" Height="24" ></controls:InfoTextBox>
|
||||
<TextBlock Foreground="{StaticResource ThirdlyTextBrush}" Margin="0,6,0,0" FontSize="10" Text="A" HorizontalAlignment="Center"></TextBlock>
|
||||
</StackPanel>
|
||||
</UniformGrid>-->
|
||||
<Button Click="ButtonSwitch_OnClick" Padding="6" FontSize="8" BorderThickness="0" Foreground="#323534" HorizontalAlignment="Right" Height="24" Width="20" Grid.Column="2" Grid.Row="1">
|
||||
<Button.Content>
|
||||
<Path Fill="#323534" Style="{StaticResource UpDownPathStyle}"></Path>
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
<UserControl x:Class="HandyControl.Controls.Growl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
MinHeight="60"
|
||||
Name="UserControlThis"
|
||||
Width="320"
|
||||
Margin="0,0,0,10"
|
||||
MaxWidth="320">
|
||||
<UserControl.Triggers>
|
||||
<EventTrigger RoutedEvent="UserControl.MouseEnter">
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Button.Visibility)" Storyboard.TargetName="ButtonClose">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
<EventTrigger RoutedEvent="UserControl.MouseLeave">
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Button.Visibility)" Storyboard.TargetName="ButtonClose">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
</UserControl.Triggers>
|
||||
<Grid Name="GridMain" RenderTransformOrigin="0.5,0.5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="50"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Grid.ColumnSpan="3" Grid.RowSpan="2" Effect="{StaticResource EffectShadow2}" Background="#E5DEDEDE" CornerRadius="8" Width="320"></Border>
|
||||
<Path Grid.Row="0" Grid.Column="0" VerticalAlignment="Top" Margin="0,15,0,0" Width="30" Height="30" Data="{Binding Icon,ElementName=UserControlThis}" Stretch="Uniform" Fill="{Binding IconBrush,ElementName=UserControlThis}"></Path>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" Margin="0,12,10,10">
|
||||
<TextBlock Text="{Binding Message,ElementName=UserControlThis}" Style="{StaticResource TextBlockDefault}" HorizontalAlignment="Left" TextWrapping="Wrap"></TextBlock>
|
||||
<TextBlock Text="{Binding Time,ElementName=UserControlThis,StringFormat=yyyy/MM/dd HH:mm:ss}" Style="{StaticResource TextBlockDefault}" Foreground="{StaticResource SecondaryTextBrush}" HorizontalAlignment="Left" Margin="0,4,0,0"></TextBlock>
|
||||
</StackPanel>
|
||||
<Button Grid.Row="0" Visibility="Collapsed" Margin="11,0" Name="ButtonClose" Click="ButtonClose_OnClick" Grid.Column="2" Background="Transparent" Style="{StaticResource ButtonOpacityStyle}" VerticalAlignment="Center" HorizontalAlignment="Center" Width="18" Height="18">
|
||||
<Path Data="{StaticResource ErrorGeometry}" Stretch="Uniform" Fill="{StaticResource SecondaryTextBrush}"></Path>
|
||||
</Button>
|
||||
<StackPanel Name="PanelMore" IsEnabled="False" Visibility="Collapsed" Orientation="Horizontal" Grid.Row="1" Grid.ColumnSpan="3" Height="28" Grid.Column="0">
|
||||
<Button Click="ButtonCancel_OnClick" Style="{StaticResource ButtonOpacityStyle}" Width="160">
|
||||
<TextBlock Text="取消" HorizontalAlignment="Center" Foreground="{StaticResource DangerBrush}"></TextBlock>
|
||||
</Button>
|
||||
<Button Click="ButtonOk_OnClick" Style="{StaticResource ButtonOpacityStyle}" Width="160">
|
||||
<TextBlock Text="确定" HorizontalAlignment="Center" Foreground="{StaticResource PrimaryBrush}"></TextBlock>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,239 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Threading;
|
||||
using HandyControl.Interactivity;
|
||||
using HandyControl.Tools;
|
||||
using HandyControl.Tools.Extension;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Growl.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class Growl
|
||||
{
|
||||
/// <summary>
|
||||
/// 最大计数
|
||||
/// </summary>
|
||||
private const int MaxTickCount = 6;
|
||||
|
||||
public static readonly DependencyProperty MessageProperty = DependencyProperty.Register(
|
||||
"Message", typeof(string), typeof(Growl), new PropertyMetadata(default(string)));
|
||||
|
||||
public static readonly DependencyProperty TimeProperty = DependencyProperty.Register(
|
||||
"Time", typeof(DateTime), typeof(Growl), new PropertyMetadata(default(DateTime)));
|
||||
|
||||
public static readonly DependencyProperty IconProperty = DependencyProperty.Register(
|
||||
"Icon", typeof(Geometry), typeof(Growl), new PropertyMetadata(default(Geometry)));
|
||||
|
||||
public static readonly DependencyProperty IconBrushProperty = DependencyProperty.Register(
|
||||
"IconBrush", typeof(Brush), typeof(Growl), new PropertyMetadata(default(Brush)));
|
||||
|
||||
/// <summary>
|
||||
/// 消息容器
|
||||
/// </summary>
|
||||
private static Panel GrowlPanel;
|
||||
|
||||
/// <summary>
|
||||
/// 计数
|
||||
/// </summary>
|
||||
private int _tickCount;
|
||||
|
||||
/// <summary>
|
||||
/// 关闭计时器
|
||||
/// </summary>
|
||||
private DispatcherTimer _timerClose;
|
||||
|
||||
public Growl() => InitializeComponent();
|
||||
|
||||
private Action<Action, bool> CloseAction { get; set; }
|
||||
|
||||
public string Message
|
||||
{
|
||||
get => (string)GetValue(MessageProperty);
|
||||
set => SetValue(MessageProperty, value);
|
||||
}
|
||||
|
||||
public DateTime Time
|
||||
{
|
||||
get => (DateTime)GetValue(TimeProperty);
|
||||
set => SetValue(TimeProperty, value);
|
||||
}
|
||||
|
||||
public Geometry Icon
|
||||
{
|
||||
get => (Geometry)GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
}
|
||||
|
||||
public Brush IconBrush
|
||||
{
|
||||
get => (Brush)GetValue(IconBrushProperty);
|
||||
set => SetValue(IconBrushProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 开始计时器
|
||||
/// </summary>
|
||||
private void StartTimer()
|
||||
{
|
||||
_timerClose = new DispatcherTimer
|
||||
{
|
||||
Interval = TimeSpan.FromSeconds(1)
|
||||
};
|
||||
_timerClose.Tick += delegate
|
||||
{
|
||||
if (IsMouseOver)
|
||||
{
|
||||
_tickCount = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
_tickCount++;
|
||||
if (_tickCount >= MaxTickCount) Close();
|
||||
};
|
||||
_timerClose.Start();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 消息容器
|
||||
/// </summary>
|
||||
/// <param name="panel"></param>
|
||||
public static void SetGrowlPanel(Panel panel)
|
||||
{
|
||||
GrowlPanel = panel;
|
||||
var menuItem = new MenuItem
|
||||
{
|
||||
Header = "清空消息"
|
||||
};
|
||||
menuItem.Click += (s, e) =>
|
||||
{
|
||||
foreach (var item in GrowlPanel.Children.OfType<Growl>())
|
||||
{
|
||||
//if (item.CloseAction != null)
|
||||
//{
|
||||
// item.Close();
|
||||
//}
|
||||
item.Close();
|
||||
}
|
||||
};
|
||||
GrowlPanel.ContextMenu = new ContextMenu
|
||||
{
|
||||
Items =
|
||||
{
|
||||
menuItem
|
||||
}
|
||||
};
|
||||
var behavior = new FluidMoveBehavior
|
||||
{
|
||||
AppliesTo = FluidMoveScope.Children,
|
||||
Duration = new Duration(TimeSpan.FromMilliseconds(400)),
|
||||
EaseY = new PowerEase()
|
||||
};
|
||||
var collection = Interaction.GetBehaviors(GrowlPanel);
|
||||
collection.Add(behavior);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示信息
|
||||
/// </summary>
|
||||
private static void Show(string message, string iconKey, string iconBrushKey, Action<Action, bool> closeAction = null,
|
||||
bool staysOpen = false, bool showCloseButton = true)
|
||||
{
|
||||
var ctl = new Growl
|
||||
{
|
||||
Message = message,
|
||||
Time = DateTime.Now,
|
||||
Icon = ResourceHelper.GetResource<Geometry>(iconKey),
|
||||
IconBrush = ResourceHelper.GetResource<Brush>(iconBrushKey)
|
||||
};
|
||||
if (!showCloseButton) ctl.Triggers.Clear();
|
||||
|
||||
if (closeAction != null)
|
||||
{
|
||||
staysOpen = true;
|
||||
ctl.Triggers.Clear();
|
||||
ctl.PanelMore.IsEnabled = true;
|
||||
ctl.PanelMore.Show();
|
||||
ctl.CloseAction = closeAction;
|
||||
}
|
||||
|
||||
var transform = new TranslateTransform
|
||||
{
|
||||
X = ctl.MaxWidth
|
||||
};
|
||||
ctl.GridMain.RenderTransform = transform;
|
||||
GrowlPanel.Children.Insert(0, ctl);
|
||||
transform.BeginAnimation(TranslateTransform.XProperty, AnimationHelper.CreateAnimation(0));
|
||||
if (!staysOpen) ctl.StartTimer();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 成功
|
||||
/// </summary>
|
||||
public static void Success(string message) => Show(message, "SuccessGeometry", "SuccessBrush");
|
||||
|
||||
/// <summary>
|
||||
/// 消息
|
||||
/// </summary>
|
||||
public static void Info(string message) => Show(message, "InfoGeometry", "InfoBrush");
|
||||
|
||||
/// <summary>
|
||||
/// 错误
|
||||
/// </summary>
|
||||
public static void Error(string message) => Show(message, "ErrorGeometry", "DangerBrush", null, true);
|
||||
|
||||
/// <summary>
|
||||
/// 警告
|
||||
/// </summary>
|
||||
public static void Warning(string message) => Show(message, "WarningGeometry", "WarningBrush");
|
||||
|
||||
/// <summary>
|
||||
/// 严重
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="showContextMenu"></param>
|
||||
public static void Fatal(string message, bool showContextMenu = true)
|
||||
{
|
||||
if (!showContextMenu)
|
||||
{
|
||||
GrowlPanel.ContextMenu.Collapse();
|
||||
}
|
||||
Show(message, "FatalGeometry", "PrimaryTextBrush", null, true, false);
|
||||
}
|
||||
|
||||
public static void Ask(string message, Action<Action, bool> closeAction) => Show(message, "AskGeometry", "AccentBrush", closeAction);
|
||||
|
||||
private void ButtonClose_OnClick(object sender, RoutedEventArgs e) => Close();
|
||||
|
||||
/// <summary>
|
||||
/// 关闭
|
||||
/// </summary>
|
||||
private void Close()
|
||||
{
|
||||
_timerClose?.Stop();
|
||||
var transform = new TranslateTransform();
|
||||
GridMain.RenderTransform = transform;
|
||||
var animation = AnimationHelper.CreateAnimation(MaxWidth);
|
||||
animation.Completed += delegate { GrowlPanel.Children.Remove(this); };
|
||||
transform.BeginAnimation(TranslateTransform.XProperty, animation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清除
|
||||
/// </summary>
|
||||
public static void Clear()
|
||||
{
|
||||
GrowlPanel.Children.Clear();
|
||||
GrowlPanel.Show();
|
||||
}
|
||||
|
||||
private void ButtonCancel_OnClick(object sender, RoutedEventArgs e) => CloseAction?.Invoke(Close, false);
|
||||
|
||||
private void ButtonOk_OnClick(object sender, RoutedEventArgs e) => CloseAction?.Invoke(Close, true);
|
||||
}
|
||||
}
|
||||
@@ -49,22 +49,32 @@ namespace HandyControl.Controls
|
||||
/// <summary>
|
||||
/// 是否支持惯性
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IsEnableInertiaProperty = DependencyProperty.Register(
|
||||
public static readonly DependencyProperty IsEnableInertiaProperty = DependencyProperty.RegisterAttached(
|
||||
"IsEnableInertia", typeof(bool), typeof(ScrollViewer), new PropertyMetadata(default(bool)));
|
||||
|
||||
public static void SetIsEnableInertia(DependencyObject element, bool value)
|
||||
{
|
||||
element.SetValue(IsEnableInertiaProperty, value);
|
||||
}
|
||||
|
||||
public static bool GetIsEnableInertia(DependencyObject element)
|
||||
{
|
||||
return (bool) element.GetValue(IsEnableInertiaProperty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否支持惯性
|
||||
/// </summary>
|
||||
public bool IsEnableInertia
|
||||
{
|
||||
get => (bool) GetValue(IsEnableInertiaProperty);
|
||||
get => (bool)GetValue(IsEnableInertiaProperty);
|
||||
set => SetValue(IsEnableInertiaProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 控件是否可以穿透点击
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IsPenetratingProperty = DependencyProperty.Register(
|
||||
public static readonly DependencyProperty IsPenetratingProperty = DependencyProperty.RegisterAttached(
|
||||
"IsPenetrating", typeof(bool), typeof(ScrollViewer), new PropertyMetadata(default(bool)));
|
||||
|
||||
/// <summary>
|
||||
@@ -72,10 +82,20 @@ namespace HandyControl.Controls
|
||||
/// </summary>
|
||||
public bool IsPenetrating
|
||||
{
|
||||
get => (bool) GetValue(IsPenetratingProperty);
|
||||
get => (bool)GetValue(IsPenetratingProperty);
|
||||
set => SetValue(IsPenetratingProperty, value);
|
||||
}
|
||||
|
||||
public static void SetIsPenetrating(DependencyObject element, bool value)
|
||||
{
|
||||
element.SetValue(IsPenetratingProperty, value);
|
||||
}
|
||||
|
||||
public static bool GetIsPenetrating(DependencyObject element)
|
||||
{
|
||||
return (bool) element.GetValue(IsPenetratingProperty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前垂直滚动偏移
|
||||
/// </summary>
|
||||
@@ -95,6 +115,7 @@ namespace HandyControl.Controls
|
||||
/// </summary>
|
||||
private double CurrentVerticalOffset
|
||||
{
|
||||
// ReSharper disable once UnusedMember.Local
|
||||
get => (double) GetValue(CurrentVerticalOffsetProperty);
|
||||
set => SetValue(CurrentVerticalOffsetProperty, value);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,259 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Animation;
|
||||
using HandyControl.Tools;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
[TemplateVisualState(GroupName = PresentationGroup, Name = NormalState)]
|
||||
[TemplateVisualState(GroupName = PresentationGroup, Name = DefaultTransitionState)]
|
||||
[TemplatePart(Name = PreviousContentPresentationSitePartName, Type = typeof(ContentControl))]
|
||||
[TemplatePart(Name = CurrentContentPresentationSitePartName, Type = typeof(ContentControl))]
|
||||
public class TransitioningContentControl : ContentControl
|
||||
{
|
||||
private Storyboard _currentTransition;
|
||||
|
||||
public TransitioningContentControl()
|
||||
{
|
||||
DefaultStyleKey = typeof(TransitioningContentControl);
|
||||
}
|
||||
|
||||
private Storyboard CurrentTransition
|
||||
{
|
||||
set
|
||||
{
|
||||
if (_currentTransition != null)
|
||||
_currentTransition.Completed -= OnTransitionCompleted;
|
||||
|
||||
_currentTransition = value;
|
||||
|
||||
if (_currentTransition != null)
|
||||
_currentTransition.Completed += OnTransitionCompleted;
|
||||
}
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
||||
public event RoutedEventHandler TransitionCompleted;
|
||||
|
||||
#endregion Events
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
if (IsTransitioning)
|
||||
AbortTransition();
|
||||
|
||||
base.OnApplyTemplate();
|
||||
|
||||
PreviousContentPresentationSite =
|
||||
GetTemplateChild(PreviousContentPresentationSitePartName) as ContentPresenter;
|
||||
CurrentContentPresentationSite =
|
||||
GetTemplateChild(CurrentContentPresentationSitePartName) as ContentPresenter;
|
||||
|
||||
if (CurrentContentPresentationSite != null)
|
||||
CurrentContentPresentationSite.Content = Content;
|
||||
|
||||
var transition = GetStoryboard(Transition);
|
||||
CurrentTransition = transition;
|
||||
if (transition == null)
|
||||
{
|
||||
Transition = DefaultTransitionState;
|
||||
|
||||
throw new ArgumentException("TransitioningContentControl_TransitionNotFound");
|
||||
}
|
||||
|
||||
VisualStateManager.GoToState(this, NormalState, false);
|
||||
VisualStateManager.GoToState(this, Transition, true);
|
||||
}
|
||||
|
||||
protected override void OnContentChanged(object oldContent, object newContent)
|
||||
{
|
||||
base.OnContentChanged(oldContent, newContent);
|
||||
|
||||
StartTransition(oldContent, newContent);
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "newContent", Justification = "Should be used in the future.")]
|
||||
private void StartTransition(object oldContent, object newContent)
|
||||
{
|
||||
if (CurrentContentPresentationSite != null && PreviousContentPresentationSite != null)
|
||||
{
|
||||
CurrentContentPresentationSite.Content = newContent;
|
||||
|
||||
PreviousContentPresentationSite.Content = oldContent;
|
||||
|
||||
if (!IsTransitioning || RestartTransitionOnContentChange)
|
||||
{
|
||||
IsTransitioning = true;
|
||||
VisualStateManager.GoToState(this, NormalState, false);
|
||||
VisualStateManager.GoToState(this, Transition, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTransitionCompleted(object sender, EventArgs e)
|
||||
{
|
||||
AbortTransition();
|
||||
|
||||
var handler = TransitionCompleted;
|
||||
handler?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
|
||||
public void AbortTransition()
|
||||
{
|
||||
VisualStateManager.GoToState(this, NormalState, false);
|
||||
IsTransitioning = false;
|
||||
if (PreviousContentPresentationSite != null)
|
||||
PreviousContentPresentationSite.Content = null;
|
||||
}
|
||||
|
||||
private Storyboard GetStoryboard(string newTransition)
|
||||
{
|
||||
var presentationGroup = VisualStates.TryGetVisualStateGroup(this, PresentationGroup);
|
||||
Storyboard newStoryboard = null;
|
||||
if (presentationGroup != null)
|
||||
newStoryboard = presentationGroup.States
|
||||
.OfType<VisualState>()
|
||||
.Where(state => state.Name == newTransition)
|
||||
.Select(state => state.Storyboard)
|
||||
.FirstOrDefault();
|
||||
return newStoryboard;
|
||||
}
|
||||
|
||||
#region Visual state names
|
||||
|
||||
private const string PresentationGroup = "PresentationStates";
|
||||
|
||||
private const string NormalState = "Normal";
|
||||
|
||||
public const string DefaultTransitionState = "DefaultTransition";
|
||||
|
||||
#endregion Visual state names
|
||||
|
||||
#region Template part names
|
||||
|
||||
internal const string PreviousContentPresentationSitePartName = "PreviousContentPresentationSite";
|
||||
|
||||
internal const string CurrentContentPresentationSitePartName = "CurrentContentPresentationSite";
|
||||
|
||||
#endregion Template part names
|
||||
|
||||
#region TemplateParts
|
||||
|
||||
private ContentPresenter CurrentContentPresentationSite { get; set; }
|
||||
|
||||
private ContentPresenter PreviousContentPresentationSite { get; set; }
|
||||
|
||||
#endregion TemplateParts
|
||||
|
||||
#region public bool IsTransitioning
|
||||
|
||||
private bool _allowIsTransitioningWrite;
|
||||
|
||||
public bool IsTransitioning
|
||||
{
|
||||
get => (bool)GetValue(IsTransitioningProperty);
|
||||
private set
|
||||
{
|
||||
_allowIsTransitioningWrite = true;
|
||||
SetValue(IsTransitioningProperty, value);
|
||||
_allowIsTransitioningWrite = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsTransitioningProperty =
|
||||
DependencyProperty.Register(
|
||||
"IsTransitioning",
|
||||
typeof(bool),
|
||||
typeof(TransitioningContentControl),
|
||||
new PropertyMetadata(OnIsTransitioningPropertyChanged));
|
||||
|
||||
private static void OnIsTransitioningPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var source = (TransitioningContentControl)d;
|
||||
|
||||
if (!source._allowIsTransitioningWrite)
|
||||
{
|
||||
source.IsTransitioning = (bool)e.OldValue;
|
||||
throw new InvalidOperationException("TransitiotioningContentControl_IsTransitioningReadOnly");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion public bool IsTransitioning
|
||||
|
||||
#region public string Transition
|
||||
|
||||
public string Transition
|
||||
{
|
||||
get => GetValue(TransitionProperty) as string;
|
||||
set => SetValue(TransitionProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty TransitionProperty =
|
||||
DependencyProperty.Register(
|
||||
"Transition",
|
||||
typeof(string),
|
||||
typeof(TransitioningContentControl),
|
||||
new PropertyMetadata(DefaultTransitionState, OnTransitionPropertyChanged));
|
||||
|
||||
private static void OnTransitionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var source = (TransitioningContentControl)d;
|
||||
var oldTransition = e.OldValue as string;
|
||||
var newTransition = e.NewValue as string;
|
||||
|
||||
if (source.IsTransitioning)
|
||||
source.AbortTransition();
|
||||
|
||||
var newStoryboard = source.GetStoryboard(newTransition);
|
||||
|
||||
if (newStoryboard == null)
|
||||
if (VisualStates.TryGetVisualStateGroup(source, PresentationGroup) == null)
|
||||
{
|
||||
source.CurrentTransition = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
source.SetValue(TransitionProperty, oldTransition);
|
||||
|
||||
throw new ArgumentException(
|
||||
"TransitioningContentControl_TransitionNotFound");
|
||||
}
|
||||
else
|
||||
source.CurrentTransition = newStoryboard;
|
||||
}
|
||||
|
||||
#endregion public string Transition
|
||||
|
||||
#region public bool RestartTransitionOnContentChange
|
||||
|
||||
public bool RestartTransitionOnContentChange
|
||||
{
|
||||
get => (bool)GetValue(RestartTransitionOnContentChangeProperty);
|
||||
set => SetValue(RestartTransitionOnContentChangeProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty RestartTransitionOnContentChangeProperty =
|
||||
DependencyProperty.Register(
|
||||
"RestartTransitionOnContentChange",
|
||||
typeof(bool),
|
||||
typeof(TransitioningContentControl),
|
||||
new PropertyMetadata(false, OnRestartTransitionOnContentChangePropertyChanged));
|
||||
|
||||
private static void OnRestartTransitionOnContentChangePropertyChanged(DependencyObject d,
|
||||
DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
((TransitioningContentControl)d).OnRestartTransitionOnContentChangeChanged((bool)e.OldValue,
|
||||
(bool)e.NewValue);
|
||||
}
|
||||
|
||||
protected virtual void OnRestartTransitionOnContentChangeChanged(bool oldValue, bool newValue)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion public bool RestartTransitionOnContentChange
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,9 @@
|
||||
<DocumentationFile>bin\Release\HandyControl.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Controls\AnimationPath.cs" />
|
||||
<Compile Include="Controls\Attach\BackgroundSwitchElement.cs" />
|
||||
<Compile Include="Controls\Attach\BorderElement.cs" />
|
||||
<Compile Include="Controls\Attach\IconSwitchElement.cs" />
|
||||
<Compile Include="Controls\Attach\StatusSwitchElement.cs" />
|
||||
<Compile Include="Controls\Carousel.xaml.cs">
|
||||
@@ -43,6 +46,9 @@
|
||||
</Compile>
|
||||
<Compile Include="Controls\Attach\IconElement.cs" />
|
||||
<Compile Include="Controls\CompareSlider.cs" />
|
||||
<Compile Include="Controls\Growl.xaml.cs">
|
||||
<DependentUpon>Growl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\ScrollViewer.cs" />
|
||||
<Compile Include="Controls\Info\InfoControl.cs" />
|
||||
<Compile Include="Controls\Info\InfoNumericUpDown.xaml.cs">
|
||||
@@ -61,6 +67,7 @@
|
||||
<Compile Include="Controls\TimeBar\TimeBar.xaml.cs">
|
||||
<DependentUpon>TimeBar.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\TransitioningContentControl.cs" />
|
||||
<Compile Include="Controls\Window\ImageBrowser.xaml.cs">
|
||||
<DependentUpon>ImageBrowser.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -122,6 +129,8 @@
|
||||
<Compile Include="Tools\MouseDragElementBehaviorEx.cs" />
|
||||
<Compile Include="Tools\RegularJudgment.cs" />
|
||||
<Compile Include="Tools\RegularPatterns.cs" />
|
||||
<Compile Include="Tools\ResourceHelper.cs" />
|
||||
<Compile Include="Tools\VisualStates.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\colorPickerBack.png" />
|
||||
@@ -135,6 +144,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Controls\Growl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Controls\Info\InfoNumericUpDown.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -227,6 +240,10 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\Base\ProgressBarBaseStyle.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\Base\ScrollViewerBaseStyle.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -271,6 +288,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\ProgressBar.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\ScrollViewer.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -287,6 +308,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\TreeView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\Window.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("HandyControl")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyDescription("Contains some commonly used simple WPF controls")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("HandyControl")]
|
||||
@@ -10,5 +10,5 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: AssemblyVersion("1.1.2.0")]
|
||||
[assembly: AssemblyFileVersion("1.1.2.0")]
|
||||
[assembly: AssemblyVersion("1.2.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.2.0.0")]
|
||||
@@ -32,4 +32,5 @@
|
||||
<SolidColorBrush x:Key="AccentBrush" Color="{DynamicResource AccentColor}"></SolidColorBrush>
|
||||
<SolidColorBrush x:Key="DarkAccentBrush" Color="{DynamicResource DarkAccentColor}"></SolidColorBrush>
|
||||
|
||||
<SolidColorBrush x:Key="DarkMaskBrush" Color="{DynamicResource DarkMaskColor}"></SolidColorBrush>
|
||||
</ResourceDictionary>
|
||||
@@ -32,4 +32,5 @@
|
||||
<Color x:Key="AccentColor">#ff5722</Color>
|
||||
<Color x:Key="DarkAccentColor">#d43f3a</Color>
|
||||
|
||||
<Color x:Key="DarkMaskColor">#20000000</Color>
|
||||
</ResourceDictionary>
|
||||
@@ -7,84 +7,68 @@
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style x:Key="ButtonBaseStyle" BasedOn="{StaticResource ButtonBaseBaseStyle}" TargetType="{x:Type Button}">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="4"></Setter>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DarkMaskBrush}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Grid>
|
||||
<Border x:Name="border" CornerRadius="4" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="0" SnapsToDevicePixels="true">
|
||||
<!--点击时显示-->
|
||||
<Grid x:Name="PressedLayer" Visibility="Collapsed">
|
||||
<Rectangle Height="3" VerticalAlignment="Top" Fill="#1F000000" RadiusX="4" RadiusY="4">
|
||||
<Rectangle.Effect>
|
||||
<BlurEffect Radius="5"></BlurEffect>
|
||||
</Rectangle.Effect>
|
||||
</Rectangle>
|
||||
<Border CornerRadius="4" BorderBrush="#1F000000" BorderThickness="1,0">
|
||||
<Border.Effect>
|
||||
<BlurEffect Radius="3"></BlurEffect>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<Border Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}"></Border>
|
||||
<Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Border>
|
||||
<!--禁用时显示-->
|
||||
<Rectangle x:Name="EnabledLayer" Fill="#4CFFFFFF" RadiusX="4" RadiusY="4" Visibility="Collapsed"/>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsPressed" Value="true">
|
||||
<Setter TargetName="PressedLayer" Property="Visibility" Value="Visible"/>
|
||||
<Setter TargetName="border" Property="BorderBrush" Value="#80cccccc"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter TargetName="EnabledLayer" Property="Visibility" Value="Visible"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Opacity" Value=".9"></Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Opacity" Value=".6"></Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value=".2"></Setter>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ButtonIconBaseStyle" BasedOn="{StaticResource ButtonBaseBaseStyle}" TargetType="{x:Type Button}">
|
||||
<Setter Property="Width" Value="{DynamicResource DefaultControlHeight}"/>
|
||||
<Setter Property="BorderThickness" Value="0"></Setter>
|
||||
<Setter Property="Padding" Value="8"></Setter>
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="4"></Setter>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DarkMaskBrush}"/>
|
||||
<Setter Property="controls:IconElement.Angle" Value="0"></Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Grid>
|
||||
<!--点击时显示-->
|
||||
<Ellipse x:Name="border" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}" Fill="{TemplateBinding Background}" SnapsToDevicePixels="true"></Ellipse>
|
||||
<Ellipse x:Name="PressedLayer" Visibility="Collapsed" Stroke="#1F000000" StrokeThickness="2">
|
||||
<Ellipse.Effect>
|
||||
<BlurEffect Radius="3"></BlurEffect>
|
||||
</Ellipse.Effect>
|
||||
</Ellipse>
|
||||
<ContentControl HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
|
||||
<Path Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding controls:IconElement.Geometry}" RenderTransformOrigin="0.5,0.5">
|
||||
<Path.RenderTransform>
|
||||
<TransformGroup>
|
||||
<RotateTransform Angle="{Binding Path=(controls:IconElement.Angle),RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||
</TransformGroup>
|
||||
</Path.RenderTransform>
|
||||
</Path>
|
||||
</ContentControl>
|
||||
<!--禁用时显示-->
|
||||
<Ellipse x:Name="EnabledLayer" Fill="#4CFFFFFF" Visibility="Collapsed"/>
|
||||
<Border Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}"></Border>
|
||||
<Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<ContentControl HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
|
||||
<Path Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding controls:IconElement.Geometry}" RenderTransformOrigin="0.5,0.5">
|
||||
<Path.RenderTransform>
|
||||
<TransformGroup>
|
||||
<RotateTransform Angle="{Binding Path=(controls:IconElement.Angle),RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||
</TransformGroup>
|
||||
</Path.RenderTransform>
|
||||
</Path>
|
||||
</ContentControl>
|
||||
</Border>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsPressed" Value="true">
|
||||
<Setter TargetName="PressedLayer" Property="Visibility" Value="Visible"/>
|
||||
<Setter TargetName="border" Property="Stroke" Value="#80cccccc"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter TargetName="EnabledLayer" Property="Visibility" Value="Visible"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Opacity" Value=".9"></Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Opacity" Value=".6"></Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value=".2"></Setter>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,51 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<LinearGradientBrush x:Key="ProgressBarIndicatorAnimatedFill" StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientStop Color="#00FFFFFF" Offset="0"/>
|
||||
<GradientStop Color="#60FFFFFF" Offset="0.4"/>
|
||||
<GradientStop Color="#60FFFFFF" Offset="0.6"/>
|
||||
<GradientStop Color="#00FFFFFF" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<Style x:Key="ProgressBarBaseStyle" TargetType="{x:Type ProgressBar}">
|
||||
<Setter Property="Height" Value="20"/>
|
||||
<Setter Property="Background" Value="#f5f5f5"/>
|
||||
<Setter Property="BorderBrush" Value="#19000000"/>
|
||||
<Setter Property="BorderThickness" Value="1,1,1,0"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ProgressBar}">
|
||||
<Grid>
|
||||
<Border x:Name="TemplateRoot" CornerRadius="4" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
|
||||
<Border.Effect>
|
||||
<BlurEffect Radius="2"></BlurEffect>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
<Grid Margin="{TemplateBinding BorderThickness}">
|
||||
<Rectangle x:Name="PART_Track"/>
|
||||
<Grid HorizontalAlignment="Left">
|
||||
<Decorator x:Name="PART_Indicator" HorizontalAlignment="Left" Margin="0,-1,0,0">
|
||||
<Border CornerRadius="4" x:Name="Animation" ClipToBounds="true" Background="{TemplateBinding Foreground}">
|
||||
<Rectangle x:Name="PART_GlowRect" Fill="{StaticResource ProgressBarIndicatorAnimatedFill}" HorizontalAlignment="Left" Margin="-100,0,0,0" Width="100"/>
|
||||
</Border>
|
||||
</Decorator>
|
||||
<TextBlock HorizontalAlignment="Center" Foreground="{DynamicResource TextIconBrush}" Text="{Binding Value,RelativeSource={RelativeSource FindAncestor,AncestorType=ProgressBar},StringFormat={}{0} %}"></TextBlock>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Orientation" Value="Vertical">
|
||||
<Setter Property="LayoutTransform" TargetName="TemplateRoot">
|
||||
<Setter.Value>
|
||||
<RotateTransform Angle="-90"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -115,7 +115,25 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<ControlTemplate x:Key="ScrollviewerBaseControlTemplate" TargetType="{x:Type controls:ScrollViewer}">
|
||||
<ControlTemplate x:Key="ScrollViewerBaseControlTemplate" TargetType="{x:Type controls:ScrollViewer}">
|
||||
<ControlTemplate.Resources>
|
||||
<Storyboard x:Key="Storyboard1">
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_VerticalScrollBar">
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:.2" Value=".8"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_HorizontalScrollBar">
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:.2" Value=".8"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
<Storyboard x:Key="Storyboard2">
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_VerticalScrollBar">
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:.2" Value="0"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_HorizontalScrollBar">
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:.2" Value="0"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</ControlTemplate.Resources>
|
||||
<Grid x:Name="Grid" Background="{TemplateBinding Background}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
@@ -125,17 +143,24 @@
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Rectangle x:Name="Corner" Grid.Column="1" StrokeThickness="0" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Grid.Row="1"/>
|
||||
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
|
||||
<ScrollBar x:Name="PART_VerticalScrollBar" Style="{StaticResource ScrollBarBaseStyle}" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>
|
||||
<ScrollBar x:Name="PART_HorizontalScrollBar" Style="{StaticResource ScrollBarBaseStyle}" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
|
||||
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" Grid.ColumnSpan="2" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
|
||||
<ScrollBar x:Name="PART_VerticalScrollBar" Opacity="0.8" Style="{StaticResource ScrollBarBaseStyle}" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>
|
||||
<ScrollBar x:Name="PART_HorizontalScrollBar" Opacity="0.8" Style="{StaticResource ScrollBarBaseStyle}" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<EventTrigger RoutedEvent="MouseEnter">
|
||||
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
|
||||
</EventTrigger>
|
||||
<EventTrigger RoutedEvent="MouseLeave">
|
||||
<BeginStoryboard Storyboard="{StaticResource Storyboard2}"/>
|
||||
</EventTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<Style x:Key="ScrollViewerBaseStyle" TargetType="{x:Type controls:ScrollViewer}">
|
||||
<Setter Property="VerticalScrollBarVisibility" Value="Auto"></Setter>
|
||||
<Setter Property="Focusable" Value="False"/>
|
||||
<Setter Property="Template" Value="{StaticResource ScrollviewerBaseControlTemplate}"></Setter>
|
||||
<Setter Property="Template" Value="{StaticResource ScrollViewerBaseControlTemplate}"></Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -1,49 +1,43 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ButtonBaseBaseStyle.xaml"></ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style x:Key="ToggleButtonBaseStyle" BasedOn="{StaticResource ButtonBaseBaseStyle}" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="4"></Setter>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DarkMaskBrush}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||||
<Grid>
|
||||
<Border x:Name="border" CornerRadius="4" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="0" SnapsToDevicePixels="true">
|
||||
<!--点下时显示-->
|
||||
<Grid x:Name="CheckedLayer" Visibility="Collapsed">
|
||||
<Rectangle Height="3" VerticalAlignment="Top" Fill="#1F000000" RadiusX="4" RadiusY="4">
|
||||
<Rectangle.Effect>
|
||||
<BlurEffect Radius="5"></BlurEffect>
|
||||
</Rectangle.Effect>
|
||||
</Rectangle>
|
||||
<Border CornerRadius="4" BorderBrush="#1F000000" BorderThickness="1,0">
|
||||
<Border.Effect>
|
||||
<BlurEffect Radius="3"></BlurEffect>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<Border Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}"></Border>
|
||||
<Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Border>
|
||||
<!--禁用时显示-->
|
||||
<Rectangle x:Name="EnabledLayer" Fill="#4CFFFFFF" RadiusX="4" RadiusY="4" Visibility="Collapsed"/>
|
||||
<Border Visibility="Collapsed" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="BorderChecked" BorderThickness="4" BorderBrush="{TemplateBinding BorderBrush}"></Border>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="true">
|
||||
<Setter TargetName="CheckedLayer" Property="Visibility" Value="Visible"/>
|
||||
<Setter TargetName="border" Property="BorderBrush" Value="#80cccccc"/>
|
||||
<Setter TargetName="border" Property="BorderThickness" Value="4"></Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter TargetName="EnabledLayer" Property="Visibility" Value="Visible"/>
|
||||
<Setter TargetName="BorderChecked" Property="Visibility" Value="Visible"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Opacity" Value=".9"></Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Opacity" Value=".6"></Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value=".2"></Setter>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -2,6 +2,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||
|
||||
<!--引用自https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit-->
|
||||
<Style x:Key="ToggleButtonSwitchBaseStyle" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
@@ -140,45 +141,46 @@
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToggleButtonIconBaseStyle" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"></Setter>
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"></Setter>
|
||||
<Setter Property="Width" Value="{DynamicResource DefaultControlHeight}"/>
|
||||
<Setter Property="Height" Value="{DynamicResource DefaultControlHeight}"/>
|
||||
<Setter Property="Padding" Value="8"></Setter>
|
||||
<Setter Property="controls:IconSwitchElement.Geometry" Value="{x:Null}"></Setter>
|
||||
<Setter Property="controls:IconSwitchElement.GeometrySelected" Value="{x:Null}"></Setter>
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="4"></Setter>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DarkMaskBrush}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||||
<Grid>
|
||||
<!--点击时显示-->
|
||||
<Ellipse x:Name="border" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}" Fill="{TemplateBinding Background}" SnapsToDevicePixels="true"></Ellipse>
|
||||
<Ellipse x:Name="PressedLayer" Visibility="Collapsed" Stroke="#1F000000" StrokeThickness="2">
|
||||
<Ellipse.Effect>
|
||||
<BlurEffect Radius="3"></BlurEffect>
|
||||
</Ellipse.Effect>
|
||||
</Ellipse>
|
||||
<ContentControl HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
|
||||
<Path x:Name="PathIcon" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding controls:IconSwitchElement.Geometry}"></Path>
|
||||
</ContentControl>
|
||||
<!--禁用时显示-->
|
||||
<Ellipse x:Name="EnabledLayer" Fill="#4CFFFFFF" Visibility="Collapsed"/>
|
||||
<Border Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}"></Border>
|
||||
<Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<ContentControl HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
|
||||
<Path x:Name="PathIcon" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding controls:IconSwitchElement.Geometry}"></Path>
|
||||
</ContentControl>
|
||||
</Border>
|
||||
<Border Visibility="Collapsed" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="BorderChecked" BorderThickness="4" BorderBrush="{TemplateBinding BorderBrush}"></Border>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter TargetName="PathIcon" Property="Data" Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(controls:IconSwitchElement.GeometrySelected)}"></Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="true">
|
||||
<Setter TargetName="PressedLayer" Property="Visibility" Value="Visible"/>
|
||||
<Setter TargetName="border" Property="Stroke" Value="#80cccccc"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter TargetName="EnabledLayer" Property="Visibility" Value="Visible"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Opacity" Value=".9"></Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Opacity" Value=".6"></Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value=".2"></Setter>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -9,64 +9,29 @@
|
||||
<!--Button-->
|
||||
<Style BasedOn="{StaticResource ButtonBaseStyle}" TargetType="{x:Type Button}">
|
||||
<Setter Property="Background" Value="{DynamicResource DefaultBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DarkDefaultBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkDefaultBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="ButtonPrimary" BasedOn="{StaticResource ButtonBaseStyle}" TargetType="{x:Type Button}">
|
||||
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DarkPrimaryBrush}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkPrimaryBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="ButtonSuccess" BasedOn="{StaticResource ButtonBaseStyle}" TargetType="{x:Type Button}">
|
||||
<Setter Property="Background" Value="{DynamicResource SuccessBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DarkSuccessBrush}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkSuccessBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="ButtonInfo" BasedOn="{StaticResource ButtonBaseStyle}" TargetType="{x:Type Button}">
|
||||
<Setter Property="Background" Value="{DynamicResource InfoBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DarkInfoBrush}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkInfoBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="ButtonWarning" BasedOn="{StaticResource ButtonBaseStyle}" TargetType="{x:Type Button}">
|
||||
<Setter Property="Background" Value="{DynamicResource WarningBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DarkWarningBrush}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkWarningBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="ButtonDanger" BasedOn="{StaticResource ButtonBaseStyle}" TargetType="{x:Type Button}">
|
||||
<Setter Property="Background" Value="{DynamicResource DangerBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DarkDangerBrush}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkDangerBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!--ButtonIcon-->
|
||||
<Style x:Key="ButtonIconTransparent" BasedOn="{StaticResource ButtonIconBaseStyle}" TargetType="{x:Type Button}">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="0"></Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
@@ -84,99 +49,26 @@
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Opacity" Value=".9"></Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Opacity" Value=".6"></Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value=".2"></Setter>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="ButtonIconDefault" BasedOn="{StaticResource ButtonIconBaseStyle}" TargetType="{x:Type Button}">
|
||||
<Setter Property="Background" Value="{DynamicResource DefaultBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DarkDefaultBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkDefaultBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="ButtonIconPrimary" BasedOn="{StaticResource ButtonIconBaseStyle}" TargetType="{x:Type Button}">
|
||||
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DarkPrimaryBrush}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkPrimaryBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="ButtonIconSuccess" BasedOn="{StaticResource ButtonIconBaseStyle}" TargetType="{x:Type Button}">
|
||||
<Setter Property="Background" Value="{DynamicResource SuccessBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DarkSuccessBrush}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkSuccessBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="ButtonIconInfo" BasedOn="{StaticResource ButtonIconBaseStyle}" TargetType="{x:Type Button}">
|
||||
<Setter Property="Background" Value="{DynamicResource InfoBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DarkInfoBrush}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkInfoBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="ButtonIconWarning" BasedOn="{StaticResource ButtonIconBaseStyle}" TargetType="{x:Type Button}">
|
||||
<Setter Property="Background" Value="{DynamicResource WarningBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DarkWarningBrush}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkWarningBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="ButtonIconDanger" BasedOn="{StaticResource ButtonIconBaseStyle}" TargetType="{x:Type Button}">
|
||||
<Setter Property="Background" Value="{DynamicResource DangerBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DarkDangerBrush}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkDangerBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="CommonButtonFeStyle" TargetType="{x:Type Button}">
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Foreground" Value="#bfcbd9"></Setter>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter>
|
||||
<Setter Property="RenderTransformOrigin" Value=".5,.5"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border x:Name="border" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
|
||||
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Foreground" Value="#8c939d"></Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Foreground" Value="#bfcbd9"></Setter>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ButtonOpacityStyle" TargetType="{x:Type Button}">
|
||||
@@ -195,20 +87,22 @@
|
||||
<Border x:Name="Chrome" SnapsToDevicePixels="true" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
|
||||
<ContentPresenter Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Opacity" Value=".9"></Setter>
|
||||
<Setter Property="Background" TargetName="Chrome" Value="{Binding Path=(controls:BackgroundSwitchElement.MouseHoverBackground),RelativeSource={RelativeSource TemplatedParent}}"></Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Opacity" Value=".6"></Setter>
|
||||
<Setter Property="Background" TargetName="Chrome" Value="{Binding Path=(controls:BackgroundSwitchElement.MouseDownBackground),RelativeSource={RelativeSource TemplatedParent}}"></Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value=".2"></Setter>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Opacity" Value=".9"></Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Opacity" Value=".6"></Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value=".2"></Setter>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -33,7 +33,7 @@
|
||||
<ColumnDefinition Width="{TemplateBinding MinHeight}"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter ContentSource="Header"></ContentPresenter>
|
||||
<ToggleButton Grid.Column="1" Padding="0" Margin="0,0,10,0" Width="12" Height="12" VerticalAlignment="Center" HorizontalAlignment="Right" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" controls:IconSwitchElement.Geometry="{StaticResource DownGeometry}" controls:IconSwitchElement.GeometrySelected="{StaticResource UpGeometry}" Style="{StaticResource ToggleButtonIconTransparent}"></ToggleButton>
|
||||
<ToggleButton Foreground="{TemplateBinding Foreground}" Grid.Column="1" Padding="0" Margin="0,0,10,0" Width="12" Height="12" VerticalAlignment="Center" HorizontalAlignment="Right" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" controls:IconSwitchElement.Geometry="{StaticResource DownGeometry}" controls:IconSwitchElement.GeometrySelected="{StaticResource UpGeometry}" Style="{StaticResource ToggleButtonIconTransparent}"></ToggleButton>
|
||||
</Grid>
|
||||
</ToggleButton.Content>
|
||||
</ToggleButton>
|
||||
@@ -48,35 +48,6 @@
|
||||
<Setter Property="Opacity" Value="2"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
<!--<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="3" SnapsToDevicePixels="true">
|
||||
<DockPanel>
|
||||
<ToggleButton x:Name="HeaderSite" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" Content="{TemplateBinding Header}" DockPanel.Dock="Top" Foreground="{TemplateBinding Foreground}" FontWeight="{TemplateBinding FontWeight}" FocusVisualStyle="{StaticResource ExpanderHeaderFocusVisual}" FontStyle="{TemplateBinding FontStyle}" FontStretch="{TemplateBinding FontStretch}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" MinWidth="0" MinHeight="0" Padding="{TemplateBinding Padding}" Style="{StaticResource ExpanderDownHeaderStyle}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
<ContentPresenter x:Name="ExpandSite" DockPanel.Dock="Bottom" Focusable="false" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Visibility="Collapsed" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsExpanded" Value="true">
|
||||
<Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
|
||||
</Trigger>
|
||||
<Trigger Property="ExpandDirection" Value="Right">
|
||||
<Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Right"/>
|
||||
<Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Left"/>
|
||||
<Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderRightHeaderStyle}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="ExpandDirection" Value="Up">
|
||||
<Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Top"/>
|
||||
<Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Bottom"/>
|
||||
<Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderUpHeaderStyle}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="ExpandDirection" Value="Left">
|
||||
<Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Left"/>
|
||||
<Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Right"/>
|
||||
<Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderLeftHeaderStyle}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>-->
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Base/ProgressBarBaseStyle.xaml"></ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style BasedOn="{StaticResource ProgressBarBaseStyle}" TargetType="{x:Type ProgressBar}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ProgressBarSuccess" BasedOn="{StaticResource ProgressBarBaseStyle}" TargetType="{x:Type ProgressBar}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource SuccessBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ProgressBarInfo" BasedOn="{StaticResource ProgressBarBaseStyle}" TargetType="{x:Type ProgressBar}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource InfoBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ProgressBarWarning" BasedOn="{StaticResource ProgressBarBaseStyle}" TargetType="{x:Type ProgressBar}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource WarningBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ProgressBarDanger" BasedOn="{StaticResource ProgressBarBaseStyle}" TargetType="{x:Type ProgressBar}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource DangerBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ProgressBarPrimaryStripe" BasedOn="{StaticResource ProgressBarBaseStyle}" TargetType="{x:Type ProgressBar}">
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>
|
||||
<DrawingBrush Viewport="0,0,20,32" TileMode="Tile" ViewportUnits="Absolute" Stretch="None">
|
||||
<DrawingBrush.Transform>
|
||||
<TransformGroup>
|
||||
<RotateTransform Angle="20"/>
|
||||
<TranslateTransform x:Name="MyTransform" X="0"/>
|
||||
</TransformGroup>
|
||||
</DrawingBrush.Transform>
|
||||
<DrawingBrush.Drawing>
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Brush>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="{DynamicResource PrimaryColor}" Offset="0"/>
|
||||
<GradientStop Color="{DynamicResource PrimaryColor}" Offset="0.5"/>
|
||||
<GradientStop Color="White" Offset="0.5"/>
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</GeometryDrawing.Brush>
|
||||
<GeometryDrawing.Geometry>
|
||||
<RectangleGeometry Rect="0,0,20,32"></RectangleGeometry>
|
||||
</GeometryDrawing.Geometry>
|
||||
</GeometryDrawing>
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ProgressBar}">
|
||||
<ControlTemplate.Resources>
|
||||
<Storyboard x:Key="OnLoaded">
|
||||
<DoubleAnimationUsingKeyFrames RepeatBehavior="Forever" Storyboard.TargetProperty="(Border.Background).(Brush.Transform).(TransformGroup.Children)[1].(TranslateTransform.X)" Storyboard.TargetName="Indicator">
|
||||
<LinearDoubleKeyFrame KeyTime="0" Value="0"/>
|
||||
<LinearDoubleKeyFrame KeyTime="0:0:.25" Value="21"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</ControlTemplate.Resources>
|
||||
<Grid x:Name="TemplateRoot" SnapsToDevicePixels="true">
|
||||
<Border CornerRadius="4" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
|
||||
<Border.Effect>
|
||||
<BlurEffect Radius="2"></BlurEffect>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
<Rectangle x:Name="PART_Track" Margin="1"/>
|
||||
<Decorator x:Name="PART_Indicator" HorizontalAlignment="Left" Margin="1">
|
||||
<Grid x:Name="Foreground">
|
||||
<Border x:Name="Indicator" CornerRadius="4" Background="{TemplateBinding Foreground}"></Border>
|
||||
</Grid>
|
||||
</Decorator>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<EventTrigger RoutedEvent="FrameworkElement.Loaded" SourceName="Indicator">
|
||||
<BeginStoryboard Storyboard="{StaticResource OnLoaded}"/>
|
||||
</EventTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ProgressBarSuccessStripe" BasedOn="{StaticResource ProgressBarPrimaryStripe}" TargetType="{x:Type ProgressBar}">
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>
|
||||
<DrawingBrush Viewport="0,0,20,32" TileMode="Tile" ViewportUnits="Absolute" Stretch="None">
|
||||
<DrawingBrush.Transform>
|
||||
<TransformGroup>
|
||||
<RotateTransform Angle="20"/>
|
||||
<TranslateTransform x:Name="MyTransform" X="0"/>
|
||||
</TransformGroup>
|
||||
</DrawingBrush.Transform>
|
||||
<DrawingBrush.Drawing>
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Brush>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="{DynamicResource SuccessColor}" Offset="0"/>
|
||||
<GradientStop Color="{DynamicResource SuccessColor}" Offset="0.5"/>
|
||||
<GradientStop Color="White" Offset="0.5"/>
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</GeometryDrawing.Brush>
|
||||
<GeometryDrawing.Geometry>
|
||||
<RectangleGeometry Rect="0,0,20,32"></RectangleGeometry>
|
||||
</GeometryDrawing.Geometry>
|
||||
</GeometryDrawing>
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ProgressBarInfoStripe" BasedOn="{StaticResource ProgressBarPrimaryStripe}" TargetType="{x:Type ProgressBar}">
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>
|
||||
<DrawingBrush Viewport="0,0,20,32" TileMode="Tile" ViewportUnits="Absolute" Stretch="None">
|
||||
<DrawingBrush.Transform>
|
||||
<TransformGroup>
|
||||
<RotateTransform Angle="20"/>
|
||||
<TranslateTransform x:Name="MyTransform" X="0"/>
|
||||
</TransformGroup>
|
||||
</DrawingBrush.Transform>
|
||||
<DrawingBrush.Drawing>
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Brush>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="{DynamicResource InfoColor}" Offset="0"/>
|
||||
<GradientStop Color="{DynamicResource InfoColor}" Offset="0.5"/>
|
||||
<GradientStop Color="White" Offset="0.5"/>
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</GeometryDrawing.Brush>
|
||||
<GeometryDrawing.Geometry>
|
||||
<RectangleGeometry Rect="0,0,20,32"></RectangleGeometry>
|
||||
</GeometryDrawing.Geometry>
|
||||
</GeometryDrawing>
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ProgressBarWarningStripe" BasedOn="{StaticResource ProgressBarPrimaryStripe}" TargetType="{x:Type ProgressBar}">
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>
|
||||
<DrawingBrush Viewport="0,0,20,32" TileMode="Tile" ViewportUnits="Absolute" Stretch="None">
|
||||
<DrawingBrush.Transform>
|
||||
<TransformGroup>
|
||||
<RotateTransform Angle="20"/>
|
||||
<TranslateTransform x:Name="MyTransform" X="0"/>
|
||||
</TransformGroup>
|
||||
</DrawingBrush.Transform>
|
||||
<DrawingBrush.Drawing>
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Brush>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="{DynamicResource WarningColor}" Offset="0"/>
|
||||
<GradientStop Color="{DynamicResource WarningColor}" Offset="0.5"/>
|
||||
<GradientStop Color="White" Offset="0.5"/>
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</GeometryDrawing.Brush>
|
||||
<GeometryDrawing.Geometry>
|
||||
<RectangleGeometry Rect="0,0,20,32"></RectangleGeometry>
|
||||
</GeometryDrawing.Geometry>
|
||||
</GeometryDrawing>
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ProgressBarDangerStripe" BasedOn="{StaticResource ProgressBarPrimaryStripe}" TargetType="{x:Type ProgressBar}">
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>
|
||||
<DrawingBrush Viewport="0,0,20,32" TileMode="Tile" ViewportUnits="Absolute" Stretch="None">
|
||||
<DrawingBrush.Transform>
|
||||
<TransformGroup>
|
||||
<RotateTransform Angle="20"/>
|
||||
<TranslateTransform x:Name="MyTransform" X="0"/>
|
||||
</TransformGroup>
|
||||
</DrawingBrush.Transform>
|
||||
<DrawingBrush.Drawing>
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Brush>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="{DynamicResource DangerColor}" Offset="0"/>
|
||||
<GradientStop Color="{DynamicResource DangerColor}" Offset="0.5"/>
|
||||
<GradientStop Color="White" Offset="0.5"/>
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</GeometryDrawing.Brush>
|
||||
<GeometryDrawing.Geometry>
|
||||
<RectangleGeometry Rect="0,0,20,32"></RectangleGeometry>
|
||||
</GeometryDrawing.Geometry>
|
||||
</GeometryDrawing>
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ProgressBarFlat" TargetType="{x:Type ProgressBar}">
|
||||
<Setter Property="Height" Value="4"></Setter>
|
||||
<Setter Property="Background" Value="{DynamicResource BorderBrush}"></Setter>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryBrush}"></Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ProgressBar}">
|
||||
<Grid x:Name="TemplateRoot" SnapsToDevicePixels="true">
|
||||
<Rectangle x:Name="PART_Track" Fill="{TemplateBinding Background}" StrokeThickness="0" Stroke="{TemplateBinding BorderBrush}"/>
|
||||
<Decorator x:Name="PART_Indicator" HorizontalAlignment="Left">
|
||||
<Grid x:Name="Foreground">
|
||||
<Rectangle x:Name="Indicator" Fill="{TemplateBinding Foreground}"/>
|
||||
</Grid>
|
||||
</Decorator>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -305,6 +305,9 @@
|
||||
<Setter Property="Stroke" TargetName="PathDown" Value="White"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsDragging" Value="true">
|
||||
<Setter Property="Background" TargetName="grip" Value="{StaticResource PrimaryBrush}"/>
|
||||
<Setter Property="Stroke" TargetName="PathUp" Value="White"/>
|
||||
<Setter Property="Stroke" TargetName="PathDown" Value="White"/>
|
||||
<Trigger.EnterActions>
|
||||
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
|
||||
</Trigger.EnterActions>
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
<ResourceDictionary Source="Border.xaml"></ResourceDictionary>
|
||||
<!--<ResourceDictionary Source="BulletCheckBox.xaml"></ResourceDictionary>-->
|
||||
<!--<ResourceDictionary Source="Label.xaml"></ResourceDictionary>-->
|
||||
<!--<ResourceDictionary Source="ProgressBar.xaml"></ResourceDictionary>-->
|
||||
<ResourceDictionary Source="ProgressBar.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="ScrollViewer.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="Slider.xaml"></ResourceDictionary>
|
||||
<!--<ResourceDictionary Source="Clock.xaml"></ResourceDictionary>-->
|
||||
<!--<ResourceDictionary Source="TreeView.xaml"></ResourceDictionary>-->
|
||||
<ResourceDictionary Source="TreeView.xaml"></ResourceDictionary>
|
||||
<!--<ResourceDictionary Source="DataGrid.xaml"></ResourceDictionary>-->
|
||||
<!--<ResourceDictionary Source="GroupBox.xaml"></ResourceDictionary>-->
|
||||
<ResourceDictionary Source="Pagination.xaml"></ResourceDictionary>
|
||||
|
||||
@@ -10,75 +10,59 @@
|
||||
<!--普通-->
|
||||
<Style BasedOn="{StaticResource ToggleButtonBaseStyle}" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Background" Value="{DynamicResource DefaultBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DarkDefaultBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkDefaultBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToggleButtonPrimary" BasedOn="{StaticResource ToggleButtonBaseStyle}" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DarkPrimaryBrush}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkPrimaryBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToggleButtonSuccess" BasedOn="{StaticResource ToggleButtonBaseStyle}" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Background" Value="{DynamicResource SuccessBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DarkSuccessBrush}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkSuccessBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToggleButtonInfo" BasedOn="{StaticResource ToggleButtonBaseStyle}" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Background" Value="{DynamicResource InfoBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DarkInfoBrush}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkInfoBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToggleButtonWarning" BasedOn="{StaticResource ToggleButtonBaseStyle}" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Background" Value="{DynamicResource WarningBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DarkWarningBrush}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkWarningBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToggleButtonDanger" BasedOn="{StaticResource ToggleButtonBaseStyle}" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Background" Value="{DynamicResource DangerBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource DarkDangerBrush}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkDangerBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!--开关-->
|
||||
<Style x:Key="ToggleButtonSwitch" BasedOn="{StaticResource ToggleButtonSwitchBaseStyle}" TargetType="{x:Type ToggleButton}"></Style>
|
||||
<!--图标-->
|
||||
<Style x:Key="ToggleButtonIcon" BasedOn="{StaticResource ToggleButtonIconBaseStyle}" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Background" Value="{DynamicResource DefaultBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
</Style>
|
||||
|
||||
<!--icon-->
|
||||
<Style x:Key="ToggleButtonIcon" BasedOn="{StaticResource ToggleButtonIconBaseStyle}" TargetType="{x:Type ToggleButton}"></Style>
|
||||
<Style x:Key="ToggleButtonIconPrimary" BasedOn="{StaticResource ToggleButtonIconBaseStyle}" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToggleButtonIconSuccess" BasedOn="{StaticResource ToggleButtonIconBaseStyle}" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Background" Value="{DynamicResource SuccessBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToggleButtonIconInfo" BasedOn="{StaticResource ToggleButtonIconBaseStyle}" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Background" Value="{DynamicResource InfoBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToggleButtonIconWarning" BasedOn="{StaticResource ToggleButtonIconBaseStyle}" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Background" Value="{DynamicResource WarningBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToggleButtonIconDanger" BasedOn="{StaticResource ToggleButtonIconBaseStyle}" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Background" Value="{DynamicResource DangerBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToggleButtonIconTransparent" BasedOn="{StaticResource ToggleButtonIconBaseStyle}" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="White"></Setter>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||||
@@ -95,19 +79,12 @@
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Opacity" Value=".9"></Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Opacity" Value=".6"></Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value=".2"></Setter>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!--开关-->
|
||||
<Style x:Key="ToggleButtonSwitch" BasedOn="{StaticResource ToggleButtonSwitchBaseStyle}" TargetType="{x:Type ToggleButton}"></Style>
|
||||
|
||||
<!--自定义-->
|
||||
<Style x:Key="ToggleButtonOpacityStyle" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Background" Value="Transparent"></Setter>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"></Setter>
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
<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="../Basic/Converters.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="Base/BaseStyle.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="Base/ScrollViewerBaseStyle.xaml"></ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<PathGeometry x:Key="TreeArrow" Figures="M508.893248 762.931659a65.039498 65.039498 0 0 1-46.420659-19.485839L97.125746 371.004022c-25.143018-25.634319-24.752868-66.816849 0.881451-91.959868 25.648769-25.164693 66.809624-24.745643 91.959867 0.881451l318.933409 325.125238 318.933408-325.125238a65.025048 65.025048 0 0 1 92.841318 91.078417L555.313907 743.44582a65.025048 65.025048 0 0 1-46.420659 19.485839z"/>
|
||||
<Style x:Key="ExpandCollapseToggleStyle" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Focusable" Value="False"/>
|
||||
<Setter Property="Width" Value="16"/>
|
||||
<Setter Property="Height" Value="16"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||||
<Border Background="Transparent" Height="16" Padding="4" Width="16">
|
||||
<Path x:Name="ExpandPath" RenderTransformOrigin="0.5,0.5" Stretch="Uniform" Data="{StaticResource TreeArrow}" Fill="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type TreeViewItem}}}">
|
||||
<Path.RenderTransform>
|
||||
<RotateTransform Angle="-90"/>
|
||||
</Path.RenderTransform>
|
||||
</Path>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter Property="RenderTransform" TargetName="ExpandPath">
|
||||
<Setter.Value>
|
||||
<RotateTransform Angle="0"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type TreeViewItem}">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Padding" Value="10,0"></Setter>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="BorderThickness" Value="0"></Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="TreeViewItem">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="32"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
|
||||
<StackPanel Orientation="Horizontal" Margin="{Binding Converter={StaticResource TreeViewItemMarginConverter}, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TreeViewItem}}}">
|
||||
<ToggleButton x:Name="Expander" ClickMode="Press" IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ExpandCollapseToggleStyle}"/>
|
||||
<ContentPresenter VerticalAlignment="Center" x:Name="PART_Header" ContentSource="Header" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<ItemsPresenter x:Name="ItemsHost" Grid.Row="1"/>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsMouseOver" Value="true"/>
|
||||
<Condition Property="HasItems" Value="false"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource DarkDefaultBrush}"/>
|
||||
</MultiTrigger>
|
||||
<Trigger Property="IsExpanded" Value="false">
|
||||
<Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed"/>
|
||||
</Trigger>
|
||||
<Trigger Property="HasItems" Value="false">
|
||||
<Setter Property="Visibility" TargetName="Expander" Value="Hidden"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="true">
|
||||
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource PrimaryBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/>
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsSelected" Value="true"/>
|
||||
<Condition Property="IsSelectionActive" Value="false"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}}"/>
|
||||
</MultiTrigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type TreeView}" BasedOn="{StaticResource BaseStyle}">
|
||||
<Setter Property="Background" Value="{DynamicResource TextIconBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"></Setter>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="FontSize" Value="14"></Setter>
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
|
||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
|
||||
<Setter Property="ScrollViewer.PanningMode" Value="Both"/>
|
||||
<Setter Property="controls:ScrollViewer.IsEnableInertia" Value="False"></Setter>
|
||||
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="True"></Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TreeView}">
|
||||
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true">
|
||||
<controls:ScrollViewer x:Name="_tv_scrollviewer_" IsEnableInertia="{Binding Path=(controls:ScrollViewer.IsEnableInertia),RelativeSource={RelativeSource TemplatedParent}}" Template="{StaticResource ScrollViewerBaseControlTemplate}" Background="{TemplateBinding Background}" CanContentScroll="false" Focusable="false" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
|
||||
<ItemsPresenter/>
|
||||
</controls:ScrollViewer>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="VirtualizingPanel.IsVirtualizing" Value="true">
|
||||
<Setter Property="CanContentScroll" TargetName="_tv_scrollviewer_" Value="true"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="VirtualizingPanel.IsVirtualizing" Value="true">
|
||||
<Setter Property="ItemsPanel">
|
||||
<Setter.Value>
|
||||
<ItemsPanelTemplate>
|
||||
<VirtualizingStackPanel/>
|
||||
</ItemsPanelTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -125,4 +125,106 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="controls:TransitioningContentControl">
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
<Setter Property="Focusable" Value="False"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="Transition" Value="DefaultTransition" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:TransitioningContentControl">
|
||||
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="PresentationStates">
|
||||
<VisualState x:Name="DefaultTransition">
|
||||
<Storyboard>
|
||||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="PreviousContentPresentationSite" Storyboard.TargetProperty="(UIElement.Opacity)">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00.300" Value="0"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimation BeginTime="00:00:00" Duration="00:00:00.500" Storyboard.TargetName="CurrentContentPresentationSite" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" From="50" To="0">
|
||||
<DoubleAnimation.EasingFunction>
|
||||
<CubicEase EasingMode="EaseOut" />
|
||||
</DoubleAnimation.EasingFunction>
|
||||
</DoubleAnimation>
|
||||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="PreviousContentPresentationSite" Storyboard.TargetProperty="(UIElement.Opacity)">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1" />
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00.100" Value="0" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Normal">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="PreviousContentPresentationSite" Storyboard.TargetProperty="(UIElement.Visibility)">
|
||||
<DiscreteObjectKeyFrame KeyTime="00:00:00">
|
||||
<DiscreteObjectKeyFrame.Value>
|
||||
<Visibility>Collapsed</Visibility>
|
||||
</DiscreteObjectKeyFrame.Value>
|
||||
</DiscreteObjectKeyFrame>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="UpTransition">
|
||||
<Storyboard>
|
||||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="CurrentContentPresentationSite" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="30" />
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00.300" Value="0" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="PreviousContentPresentationSite" Storyboard.TargetProperty="(UIElement.Opacity)">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1" />
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00.300" Value="0" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="PreviousContentPresentationSite" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0" />
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00.300" Value="-30" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="DownTransition">
|
||||
<Storyboard>
|
||||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="CurrentContentPresentationSite" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="-40" />
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00.300" Value="0" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="PreviousContentPresentationSite" Storyboard.TargetProperty="(UIElement.Opacity)">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1" />
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00.300" Value="0" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="PreviousContentPresentationSite" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0" />
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00.300" Value="40" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<Grid>
|
||||
<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" Content="{x:Null}" ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
||||
<ContentPresenter.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform />
|
||||
<SkewTransform />
|
||||
<RotateTransform />
|
||||
<TranslateTransform />
|
||||
</TransformGroup>
|
||||
</ContentPresenter.RenderTransform>
|
||||
</ContentPresenter>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
|
||||
namespace HandyControl.Tools
|
||||
{
|
||||
/// <summary>
|
||||
/// 资源帮助类
|
||||
/// </summary>
|
||||
public class ResourceHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取字符串
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetString(string key) => Application.Current.TryFindResource(key) as string;
|
||||
|
||||
/// <summary>
|
||||
/// 获取字符串
|
||||
/// </summary>
|
||||
/// <param name="separator"></param>
|
||||
/// <param name="keyArr"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetString(string separator = ";", params string[] keyArr) =>
|
||||
string.Join(separator, keyArr.Select(key => Application.Current.TryFindResource(key) as string).ToList());
|
||||
|
||||
/// <summary>
|
||||
/// 获取字符串
|
||||
/// </summary>
|
||||
/// <param name="keyArr"></param>
|
||||
/// <returns></returns>
|
||||
public static List<string> GetStringList(params string[] keyArr) => keyArr.Select(key => Application.Current.TryFindResource(key) as string).ToList();
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public static T GetResource<T>(string key) where T : class => Application.Current.TryFindResource(key) as T;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace HandyControl.Tools
|
||||
{
|
||||
public class VisualStates
|
||||
{
|
||||
public static VisualStateGroup TryGetVisualStateGroup(DependencyObject dependencyObject, string groupName)
|
||||
{
|
||||
var root = GetImplementationRoot(dependencyObject);
|
||||
if (root == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return VisualStateManager
|
||||
.GetVisualStateGroups(root)?
|
||||
.OfType<VisualStateGroup>()
|
||||
.FirstOrDefault(group => string.CompareOrdinal(groupName, group.Name) == 0);
|
||||
}
|
||||
|
||||
public static FrameworkElement GetImplementationRoot(DependencyObject dependencyObject)
|
||||
{
|
||||
return 1 == VisualTreeHelper.GetChildrenCount(dependencyObject)
|
||||
? VisualTreeHelper.GetChild(dependencyObject, 0) as FrameworkElement
|
||||
: null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user