This commit is contained in:
Mahdi committed 2019-12-12 22:49:50 +03:30
commit 3686928c49
25 files changed
+668 -50

No files matched your search

@@ -434,6 +434,7 @@ namespace HandyControl.Controls
/// </summary>
private void Init()
{
if (_panelColor == null) return;
UpdateStatus(SelectedBrush.Color);
_panelColor.Children.Clear();
foreach (var item in _colorPresetList)
@@ -800,7 +800,7 @@ namespace HandyControl.Controls
_timerClose?.Stop();
var transform = new TranslateTransform();
_gridMain.RenderTransform = transform;
var animation = AnimationHelper.CreateAnimation(MaxWidth);
var animation = AnimationHelper.CreateAnimation(ActualWidth);
animation.Completed += (s, e) =>
{
if (Parent is Panel panel)
@@ -3,27 +3,30 @@ using System.Windows.Controls;
namespace HandyControl.Controls
{
[TemplatePart(Name = ElementGrowPanel, Type = typeof(Panel))]
internal class GrowlWindow : Window
public sealed class GrowlWindow : Window
{
private const string ElementGrowPanel = "PART_GrowPanel";
internal Panel GrowlPanel { get; set; }
public Panel GrowlPanel { get; set; }
public GrowlWindow()
internal GrowlWindow()
{
WindowStyle = WindowStyle.None;
AllowsTransparency = true;
GrowlPanel = new StackPanel
{
VerticalAlignment = VerticalAlignment.Top,
Margin = new Thickness(0, 10, 10, 10)
};
Content = new ScrollViewer
{
VerticalScrollBarVisibility = ScrollBarVisibility.Hidden,
IsEnableInertia = true,
Content = GrowlPanel
};
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
GrowlPanel = GetTemplateChild(ElementGrowPanel) as Panel;
}
public void Init()
internal void Init()
{
var desktopWorkingArea = SystemParameters.WorkArea;
Height = desktopWorkingArea.Height;
@@ -78,5 +78,14 @@ namespace HandyControl.Controls
get => (Thickness)GetValue(BadgeMarginProperty);
set => SetValue(BadgeMarginProperty, value);
}
public static readonly DependencyProperty ShowBadgeProperty = DependencyProperty.Register(
"ShowBadge", typeof(bool), typeof(Badge), new PropertyMetadata(ValueBoxes.TrueBox));
public bool ShowBadge
{
get => (bool) GetValue(ShowBadgeProperty);
set => SetValue(ShowBadgeProperty, value);
}
}
}
@@ -0,0 +1,501 @@
//reference doc : https://docs.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Controls.RelativePanel
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using HandyControl.Data;
namespace HandyControl.Controls
{
public class RelativePanel : Panel
{
private readonly Graph _childGraph;
public RelativePanel() => _childGraph = new Graph();
#region 容器对齐方式
public static readonly DependencyProperty AlignLeftWithPanelProperty = DependencyProperty.RegisterAttached(
"AlignLeftWithPanel", typeof(bool), typeof(RelativePanel), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.AffectsRender));
public static void SetAlignLeftWithPanel(DependencyObject element, bool value)
=> element.SetValue(AlignLeftWithPanelProperty, value);
public static bool GetAlignLeftWithPanel(DependencyObject element)
=> (bool) element.GetValue(AlignLeftWithPanelProperty);
public static readonly DependencyProperty AlignTopWithPanelProperty = DependencyProperty.RegisterAttached(
"AlignTopWithPanel", typeof(bool), typeof(RelativePanel), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.AffectsRender));
public static void SetAlignTopWithPanel(DependencyObject element, bool value)
=> element.SetValue(AlignTopWithPanelProperty, value);
public static bool GetAlignTopWithPanel(DependencyObject element)
=> (bool) element.GetValue(AlignTopWithPanelProperty);
public static readonly DependencyProperty AlignRightWithPanelProperty = DependencyProperty.RegisterAttached(
"AlignRightWithPanel", typeof(bool), typeof(RelativePanel), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.AffectsRender));
public static void SetAlignRightWithPanel(DependencyObject element, bool value)
=> element.SetValue(AlignRightWithPanelProperty, value);
public static bool GetAlignRightWithPanel(DependencyObject element)
=> (bool) element.GetValue(AlignRightWithPanelProperty);
public static readonly DependencyProperty AlignBottomWithPanelProperty = DependencyProperty.RegisterAttached(
"AlignBottomWithPanel", typeof(bool), typeof(RelativePanel), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.AffectsRender));
public static void SetAlignBottomWithPanel(DependencyObject element, bool value)
=> element.SetValue(AlignBottomWithPanelProperty, value);
public static bool GetAlignBottomWithPanel(DependencyObject element)
=> (bool) element.GetValue(AlignBottomWithPanelProperty);
#endregion
#region 元素间对齐方式
public static readonly DependencyProperty AlignLeftWithProperty = DependencyProperty.RegisterAttached(
"AlignLeftWith", typeof(UIElement), typeof(RelativePanel), new FrameworkPropertyMetadata(default(UIElement), FrameworkPropertyMetadataOptions.AffectsRender));
public static void SetAlignLeftWith(DependencyObject element, UIElement value)
=> element.SetValue(AlignLeftWithProperty, value);
public static UIElement GetAlignLeftWith(DependencyObject element)
=> (UIElement) element.GetValue(AlignLeftWithProperty);
public static readonly DependencyProperty AlignTopWithProperty = DependencyProperty.RegisterAttached(
"AlignTopWith", typeof(UIElement), typeof(RelativePanel), new FrameworkPropertyMetadata(default(UIElement), FrameworkPropertyMetadataOptions.AffectsRender));
public static void SetAlignTopWith(DependencyObject element, UIElement value)
=> element.SetValue(AlignTopWithProperty, value);
public static UIElement GetAlignTopWith(DependencyObject element)
=> (UIElement) element.GetValue(AlignTopWithProperty);
public static readonly DependencyProperty AlignRightWithProperty = DependencyProperty.RegisterAttached(
"AlignRightWith", typeof(UIElement), typeof(RelativePanel), new FrameworkPropertyMetadata(default(UIElement), FrameworkPropertyMetadataOptions.AffectsRender));
public static void SetAlignRightWith(DependencyObject element, UIElement value)
=> element.SetValue(AlignRightWithProperty, value);
public static UIElement GetAlignRightWith(DependencyObject element)
=> (UIElement) element.GetValue(AlignRightWithProperty);
public static readonly DependencyProperty AlignBottomWithProperty = DependencyProperty.RegisterAttached(
"AlignBottomWith", typeof(UIElement), typeof(RelativePanel), new FrameworkPropertyMetadata(default(UIElement), FrameworkPropertyMetadataOptions.AffectsRender));
public static void SetAlignBottomWith(DependencyObject element, UIElement value)
=> element.SetValue(AlignBottomWithProperty, value);
public static UIElement GetAlignBottomWith(DependencyObject element)
=> (UIElement) element.GetValue(AlignBottomWithProperty);
#endregion
#region 元素间位置关系
public static readonly DependencyProperty LeftOfProperty = DependencyProperty.RegisterAttached(
"LeftOf", typeof(UIElement), typeof(RelativePanel), new FrameworkPropertyMetadata(default(UIElement), FrameworkPropertyMetadataOptions.AffectsRender));
public static void SetLeftOf(DependencyObject element, UIElement value)
=> element.SetValue(LeftOfProperty, value);
public static UIElement GetLeftOf(DependencyObject element)
=> (UIElement)element.GetValue(LeftOfProperty);
public static readonly DependencyProperty AboveProperty = DependencyProperty.RegisterAttached(
"Above", typeof(UIElement), typeof(RelativePanel), new FrameworkPropertyMetadata(default(UIElement), FrameworkPropertyMetadataOptions.AffectsRender));
public static void SetAbove(DependencyObject element, UIElement value)
=> element.SetValue(AboveProperty, value);
public static UIElement GetAbove(DependencyObject element)
=> (UIElement)element.GetValue(AboveProperty);
public static readonly DependencyProperty RightOfProperty = DependencyProperty.RegisterAttached(
"RightOf", typeof(UIElement), typeof(RelativePanel), new FrameworkPropertyMetadata(default(UIElement), FrameworkPropertyMetadataOptions.AffectsRender));
public static void SetRightOf(DependencyObject element, UIElement value)
=> element.SetValue(RightOfProperty, value);
public static UIElement GetRightOf(DependencyObject element)
=> (UIElement)element.GetValue(RightOfProperty);
public static readonly DependencyProperty BelowProperty = DependencyProperty.RegisterAttached(
"Below", typeof(UIElement), typeof(RelativePanel), new FrameworkPropertyMetadata(default(UIElement), FrameworkPropertyMetadataOptions.AffectsRender));
public static void SetBelow(DependencyObject element, UIElement value)
=> element.SetValue(BelowProperty, value);
public static UIElement GetBelow(DependencyObject element)
=> (UIElement) element.GetValue(BelowProperty);
#endregion
#region 居中对齐方式
public static readonly DependencyProperty AlignHorizontalCenterWithPanelProperty = DependencyProperty.RegisterAttached(
"AlignHorizontalCenterWithPanel", typeof(bool), typeof(RelativePanel), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.AffectsRender));
public static void SetAlignHorizontalCenterWithPanel(DependencyObject element, bool value)
=> element.SetValue(AlignHorizontalCenterWithPanelProperty, value);
public static bool GetAlignHorizontalCenterWithPanel(DependencyObject element)
=> (bool)element.GetValue(AlignHorizontalCenterWithPanelProperty);
public static readonly DependencyProperty AlignVerticalCenterWithPanelProperty = DependencyProperty.RegisterAttached(
"AlignVerticalCenterWithPanel", typeof(bool), typeof(RelativePanel), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.AffectsRender));
public static void SetAlignVerticalCenterWithPanel(DependencyObject element, bool value)
=> element.SetValue(AlignVerticalCenterWithPanelProperty, value);
public static bool GetAlignVerticalCenterWithPanel(DependencyObject element)
=> (bool)element.GetValue(AlignVerticalCenterWithPanelProperty);
public static readonly DependencyProperty AlignHorizontalCenterWithProperty = DependencyProperty.RegisterAttached(
"AlignHorizontalCenterWith", typeof(UIElement), typeof(RelativePanel), new FrameworkPropertyMetadata(default(UIElement), FrameworkPropertyMetadataOptions.AffectsRender));
public static void SetAlignHorizontalCenterWith(DependencyObject element, UIElement value)
=> element.SetValue(AlignHorizontalCenterWithProperty, value);
public static UIElement GetAlignHorizontalCenterWith(DependencyObject element)
=> (UIElement)element.GetValue(AlignHorizontalCenterWithProperty);
public static readonly DependencyProperty AlignVerticalCenterWithProperty = DependencyProperty.RegisterAttached(
"AlignVerticalCenterWith", typeof(UIElement), typeof(RelativePanel), new FrameworkPropertyMetadata(default(UIElement), FrameworkPropertyMetadataOptions.AffectsRender));
public static void SetAlignVerticalCenterWith(DependencyObject element, UIElement value)
=> element.SetValue(AlignVerticalCenterWithProperty, value);
public static UIElement GetAlignVerticalCenterWith(DependencyObject element)
=> (UIElement)element.GetValue(AlignVerticalCenterWithProperty);
#endregion
protected override Size MeasureOverride(Size availableSize)
{
foreach (UIElement child in InternalChildren)
{
child?.Measure(availableSize);
}
return base.MeasureOverride(availableSize);
}
protected override Size ArrangeOverride(Size arrangeSize)
{
_childGraph.Reset(arrangeSize);
foreach (UIElement child in InternalChildren)
{
if (child == null) continue;
var node = _childGraph.AddNode(child);
node.AlignLeftWithNode = _childGraph.AddLink(node, GetAlignLeftWith(child));
node.AlignTopWithNode = _childGraph.AddLink(node, GetAlignTopWith(child));
node.AlignRightWithNode = _childGraph.AddLink(node, GetAlignRightWith(child));
node.AlignBottomWithNode = _childGraph.AddLink(node, GetAlignBottomWith(child));
node.LeftOfNode = _childGraph.AddLink(node, GetLeftOf(child));
node.AboveNode = _childGraph.AddLink(node, GetAbove(child));
node.RightOfNode = _childGraph.AddLink(node, GetRightOf(child));
node.BelowNode = _childGraph.AddLink(node, GetBelow(child));
node.AlignHorizontalCenterWith = _childGraph.AddLink(node, GetAlignHorizontalCenterWith(child));
node.AlignVerticalCenterWith = _childGraph.AddLink(node, GetAlignVerticalCenterWith(child));
}
if (_childGraph.CheckCyclic())
{
throw new Exception("RelativePanel error: Circular dependency detected. Layout could not complete.");
}
return arrangeSize;
}
private class GraphNode
{
public Point Position { get; set; }
public bool Arranged { get; set; }
public UIElement Element { get; }
public HashSet<GraphNode> OutgoingNodes { get; }
public GraphNode AlignLeftWithNode { get; set; }
public GraphNode AlignTopWithNode { get; set; }
public GraphNode AlignRightWithNode { get; set; }
public GraphNode AlignBottomWithNode { get; set; }
public GraphNode LeftOfNode { get; set; }
public GraphNode AboveNode { get; set; }
public GraphNode RightOfNode { get; set; }
public GraphNode BelowNode { get; set; }
public GraphNode AlignHorizontalCenterWith { get; set; }
public GraphNode AlignVerticalCenterWith { get; set; }
public GraphNode(UIElement element)
{
OutgoingNodes = new HashSet<GraphNode>();
Element = element;
}
}
private class Graph
{
private readonly Dictionary<DependencyObject, GraphNode> _nodeDic;
private Size _arrangeSize;
public Graph()
{
_nodeDic = new Dictionary<DependencyObject, GraphNode>();
}
public GraphNode AddLink(GraphNode from, UIElement to)
{
if (to == null) return null;
GraphNode nodeTo;
if (_nodeDic.ContainsKey(to))
{
nodeTo = _nodeDic[to];
}
else
{
nodeTo = new GraphNode(to);
_nodeDic[to] = nodeTo;
}
from.OutgoingNodes.Add(nodeTo);
return nodeTo;
}
public GraphNode AddNode(UIElement value)
{
if (!_nodeDic.ContainsKey(value))
{
var node = new GraphNode(value);
_nodeDic.Add(value, node);
return node;
}
return _nodeDic[value];
}
public void Reset(Size arrangeSize)
{
_arrangeSize = arrangeSize;
_nodeDic.Clear();
}
public bool CheckCyclic() => CheckCyclic(_nodeDic.Values, null);
private bool CheckCyclic(IEnumerable<GraphNode> nodes, HashSet<DependencyObject> set)
{
if (set == null)
{
set = new HashSet<DependencyObject>();
}
foreach (var node in nodes)
{
/*
* 该节点无任何依赖,所以从这里开始计算元素位置。
* 因为无任何依赖,所以忽略同级元素
*/
if (!node.Arranged && node.OutgoingNodes.Count == 0)
{
ArrangeChild(node, true);
continue;
}
// 判断依赖元素是否全部排列完毕
if (node.OutgoingNodes.All(item => item.Arranged))
{
ArrangeChild(node);
continue;
}
// 判断是否有循环
if (!set.Add(node.Element)) return true;
// 没有循环,且有依赖,则继续往下
return CheckCyclic(node.OutgoingNodes, set);
}
return false;
}
private void ArrangeChild(GraphNode node, bool ignoneSibling = false)
{
var child = node.Element;
var childSize = child.DesiredSize;
var childPos = new Point();
#region 容器居中对齐
if (GetAlignHorizontalCenterWithPanel(child))
{
childPos.X = (_arrangeSize.Width - childSize.Width) / 2;
}
if (GetAlignVerticalCenterWithPanel(child))
{
childPos.Y = (_arrangeSize.Height - childSize.Height) / 2;
}
#endregion
var alignLeftWithPanel = GetAlignLeftWithPanel(child);
var alignTopWithPanel = GetAlignTopWithPanel(child);
var alignRightWithPanel = GetAlignRightWithPanel(child);
var alignBottomWithPanel = GetAlignBottomWithPanel(child);
if (!ignoneSibling)
{
#region 元素间位置
if (node.LeftOfNode != null)
{
childPos.X = node.LeftOfNode.Position.X - childSize.Width;
}
if (node.AboveNode != null)
{
childPos.Y = node.AboveNode.Position.Y - childSize.Height;
}
if (node.RightOfNode != null)
{
childPos.X = node.RightOfNode.Position.X + node.RightOfNode.Element.DesiredSize.Width;
}
if (node.BelowNode != null)
{
childPos.Y = node.BelowNode.Position.Y + node.BelowNode.Element.DesiredSize.Height;
}
#endregion
#region 元素居中对齐
if (node.AlignHorizontalCenterWith != null)
{
childPos.X = node.AlignHorizontalCenterWith.Position.X +
(node.AlignHorizontalCenterWith.Element.DesiredSize.Width - childSize.Width) / 2;
}
if (node.AlignVerticalCenterWith != null)
{
childPos.Y = node.AlignVerticalCenterWith.Position.Y +
(node.AlignVerticalCenterWith.Element.DesiredSize.Height - childSize.Height) / 2;
}
#endregion
#region 元素间对齐
if (node.AlignLeftWithNode != null)
{
childPos.X = node.AlignLeftWithNode.Position.X;
}
if (node.AlignTopWithNode != null)
{
childPos.Y = node.AlignTopWithNode.Position.Y;
}
if (node.AlignRightWithNode != null)
{
childPos.X = node.AlignRightWithNode.Element.DesiredSize.Width + node.AlignRightWithNode.Position.X - childSize.Width;
}
if (node.AlignBottomWithNode != null)
{
childPos.Y = node.AlignBottomWithNode.Element.DesiredSize.Height + node.AlignBottomWithNode.Position.Y - childSize.Height;
}
#endregion
}
#region 容器对齐
if (alignLeftWithPanel)
{
if (node.AlignRightWithNode != null)
{
childPos.X = (node.AlignRightWithNode.Element.DesiredSize.Width + node.AlignRightWithNode.Position.X - childSize.Width) / 2;
}
else
{
childPos.X = 0;
}
}
if (alignTopWithPanel)
{
if (node.AlignBottomWithNode != null)
{
childPos.Y = (node.AlignBottomWithNode.Element.DesiredSize.Height + node.AlignBottomWithNode.Position.Y - childSize.Height) / 2;
}
else
{
childPos.Y = 0;
}
}
if (alignRightWithPanel)
{
if (alignLeftWithPanel)
{
childPos.X = (_arrangeSize.Width - childSize.Width) / 2;
}
else if(node.AlignLeftWithNode == null)
{
childPos.X = _arrangeSize.Width - childSize.Width;
}
else
{
childPos.X = (_arrangeSize.Width + node.AlignLeftWithNode.Position.X - childSize.Width) / 2;
}
}
if (alignBottomWithPanel)
{
if (alignTopWithPanel)
{
childPos.Y = (_arrangeSize.Height - childSize.Height) / 2;
}
else if (node.AlignTopWithNode == null)
{
childPos.Y = _arrangeSize.Height - childSize.Height;
}
else
{
childPos.Y = (_arrangeSize.Height + node.AlignLeftWithNode.Position.Y - childSize.Height) / 2;
}
}
#endregion
child.Arrange(new Rect(childPos.X, childPos.Y, childSize.Width, childSize.Height));
node.Position = childPos;
node.Arranged = true;
}
}
}
}
@@ -40,6 +40,8 @@ namespace HandyControl.Controls
{
if (item.Role == SideMenuItemRole.Item)
{
_isItemSelected = true;
if (Equals(item, _selectedItem)) return;
if (_selectedItem != null)
@@ -53,7 +55,6 @@ namespace HandyControl.Controls
{
Info = e.OriginalSource
});
_isItemSelected = true;
}
else
{
@@ -92,7 +93,10 @@ namespace HandyControl.Controls
}
else if(_selectedHeader != null)
{
_selectedHeader.SelectDefaultItem();
if (AutoSelect)
{
_selectedHeader.SelectDefaultItem();
}
_isItemSelected = false;
}
}
@@ -117,6 +121,15 @@ namespace HandyControl.Controls
protected override bool IsItemItsOwnContainerOverride(object item) => item is SideMenuItem;
public static readonly DependencyProperty AutoSelectProperty = DependencyProperty.Register(
"AutoSelect", typeof(bool), typeof(SideMenu), new PropertyMetadata(ValueBoxes.TrueBox));
public bool AutoSelect
{
get => (bool) GetValue(AutoSelectProperty);
set => SetValue(AutoSelectProperty, value);
}
public static readonly DependencyProperty ExpandModeProperty = DependencyProperty.Register(
"ExpandMode", typeof(ExpandMode), typeof(SideMenu), new PropertyMetadata(default(ExpandMode), OnExpandModeChanged));
@@ -102,7 +102,15 @@ namespace HandyControl.Controls
/// </summary>
internal TabPanel TabPanel
{
get => _tabPanel ??= TabControlParent.HeaderPanel;
get
{
if (_tabPanel == null && TabControlParent != null)
{
_tabPanel = TabControlParent.HeaderPanel;
}
return _tabPanel;
}
set => _tabPanel = value;
}
@@ -35,6 +35,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Sprite.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Block\ToggleBlock.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Panel\HoneycombPanel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Panel\RelativePanel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\RangeTrack.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\RangeThumb.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\TwoWayRangeBase.cs" />
@@ -90,8 +91,8 @@
<Compile Include="$(MSBuildThisFileDirectory)Controls\Cover\CoverView\CoverView.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Cover\CoverView\CoverViewContent.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Cover\CoverView\CoverViewItem.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Grid\Col.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Grid\Row.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Panel\Grid\Col.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Panel\Grid\Row.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Image\GifImage.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Image\ImageViewer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Input\ComboBox.cs" />
@@ -12,7 +12,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("2.3.0")]
[assembly: AssemblyVersion("2.4.0")]
#endif
[assembly: XmlnsDefinition("https://handyorg.github.io/handycontrol", "HandyControl.Controls")]
@@ -11,7 +11,7 @@
<ControlTemplate x:Key="BadgeTextTemplate" TargetType="controls:Badge">
<controls:SimplePanel>
<ContentPresenter />
<Border x:Name="Border" RenderTransformOrigin="0.5 0.5" Style="{StaticResource BorderCircular}" Margin="{TemplateBinding BadgeMargin}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
<Border x:Name="Border" Visibility="{TemplateBinding ShowBadge,Converter={StaticResource Boolean2VisibilityConverter}}" RenderTransformOrigin="0.5 0.5" Style="{StaticResource BorderCircular}" Margin="{TemplateBinding BadgeMargin}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
<Border.RenderTransform>
<ScaleTransform />
</Border.RenderTransform>
@@ -33,14 +33,14 @@
<ControlTemplate x:Key="BadgeDotTemplate" TargetType="controls:Badge">
<controls:SimplePanel>
<ContentPresenter />
<Border Margin="{TemplateBinding BadgeMargin}" Width="10" Height="10" CornerRadius="5" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" />
<Border Visibility="{TemplateBinding ShowBadge,Converter={StaticResource Boolean2VisibilityConverter}}" Margin="{TemplateBinding BadgeMargin}" Width="10" Height="10" CornerRadius="5" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" />
</controls:SimplePanel>
</ControlTemplate>
<ControlTemplate x:Key="BadgeProcessingTemplate" TargetType="controls:Badge">
<controls:SimplePanel>
<ContentPresenter />
<Ellipse Height="10" Width="10" Fill="{TemplateBinding Background}" RenderTransformOrigin="0.5 0.5" Margin="{TemplateBinding BadgeMargin}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Ellipse Visibility="{TemplateBinding ShowBadge,Converter={StaticResource Boolean2VisibilityConverter}}" Height="10" Width="10" Fill="{TemplateBinding Background}" RenderTransformOrigin="0.5 0.5" Margin="{TemplateBinding BadgeMargin}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Ellipse.OpacityMask>
<RadialGradientBrush>
<GradientStop Offset="0" Color="Transparent" />
@@ -62,7 +62,7 @@
</EventTrigger>
</Ellipse.Triggers>
</Ellipse>
<Border Margin="{TemplateBinding BadgeMargin}" Width="10" Height="10" CornerRadius="5" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" />
<Border Visibility="{TemplateBinding ShowBadge,Converter={StaticResource Boolean2VisibilityConverter}}" Margin="{TemplateBinding BadgeMargin}" Width="10" Height="10" CornerRadius="5" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" />
</controls:SimplePanel>
</ControlTemplate>
@@ -19,15 +19,6 @@
<Setter Property="ShowActivated" Value="False"/>
<Setter Property="ShowInTaskbar" Value="False"/>
<Setter Property="Topmost" Value="True"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:GrowlWindow">
<controls:ScrollViewer VerticalScrollBarVisibility="Hidden" IsEnableInertia="True">
<StackPanel Name="PART_GrowPanel" VerticalAlignment="Top" Margin="0,10,10,10"/>
</controls:ScrollViewer>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="controls:Growl">
@@ -56,7 +47,7 @@
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Border Grid.ColumnSpan="3" Grid.RowSpan="2" Effect="{StaticResource EffectShadow2}" Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Width="320"/>
<Border Grid.ColumnSpan="3" Grid.RowSpan="2" Effect="{StaticResource EffectShadow2}" Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}"/>
<Path Grid.Row="0" Grid.Column="0" VerticalAlignment="Top" Margin="0,15,0,0" Width="30" Height="30" Data="{TemplateBinding Icon}" Stretch="Uniform" Fill="{TemplateBinding IconBrush}"/>
<StackPanel VerticalAlignment="Center" Grid.Row="0" Grid.Column="1" Margin="0,10,10,10">
<TextBlock Text="{TemplateBinding Message}" Style="{StaticResource TextBlockDefault}" HorizontalAlignment="Left" TextWrapping="Wrap"/>
@@ -65,14 +56,14 @@
<Button Grid.Row="0" Visibility="Collapsed" Margin="11,0" Name="PART_ButtonClose" Command="interactivity:ControlCommands.Close" Grid.Column="2" Background="Transparent" Style="{StaticResource ButtonCustom}" VerticalAlignment="Center" HorizontalAlignment="Center" Width="18" Height="18">
<Path Data="{StaticResource ErrorGeometry}" Stretch="Uniform" Fill="{DynamicResource SecondaryTextBrush}"/>
</Button>
<StackPanel Name="PART_PanelMore" IsEnabled="False" Visibility="Collapsed" Orientation="Horizontal" Grid.Row="1" Grid.ColumnSpan="3" Height="28" Grid.Column="0">
<Button Command="interactivity:ControlCommands.Cancel" Style="{StaticResource ButtonCustom}" Width="160">
<UniformGrid Columns="2" Name="PART_PanelMore" IsEnabled="False" Visibility="Collapsed" Grid.Row="1" Grid.ColumnSpan="3" Height="28" Grid.Column="0">
<Button Command="interactivity:ControlCommands.Cancel" Style="{StaticResource ButtonCustom}" HorizontalAlignment="Stretch" Background="Transparent">
<TextBlock Text="{Binding CancelStr,RelativeSource={RelativeSource TemplatedParent}}" HorizontalAlignment="Center" Foreground="{DynamicResource DangerBrush}"/>
</Button>
<Button Command="interactivity:ControlCommands.Confirm" Style="{StaticResource ButtonCustom}" Width="160">
<Button Command="interactivity:ControlCommands.Confirm" Style="{StaticResource ButtonCustom}" HorizontalAlignment="Stretch" Background="Transparent">
<TextBlock Text="{Binding ConfirmStr,RelativeSource={RelativeSource TemplatedParent}}" HorizontalAlignment="Center" Foreground="{DynamicResource PrimaryBrush}"/>
</Button>
</StackPanel>
</UniformGrid>
</Grid>
</ControlTemplate>
</Setter.Value>
@@ -55,9 +55,8 @@ namespace HandyControl.Tools.Converter
if (destinationType == null) throw new ArgumentNullException(nameof(destinationType));
if (!(value is ColLayout)) throw new ArgumentException("UnexpectedParameterType");
if (!(value is ColLayout th)) throw new ArgumentException("UnexpectedParameterType");
var th = (ColLayout)value;
if (destinationType == typeof(string)) return ToString(th, cultureInfo);
if (destinationType == typeof(InstanceDescriptor))
{