diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Panuon.UI.Silver.Internal.projitems b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Panuon.UI.Silver.Internal.projitems index df2f3165..b355d721 100644 --- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Panuon.UI.Silver.Internal.projitems +++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Panuon.UI.Silver.Internal.projitems @@ -89,6 +89,7 @@ + diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Resources/TemplateKeys.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Resources/TemplateKeys.cs index b317b4f9..f8d864fd 100644 --- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Resources/TemplateKeys.cs +++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Resources/TemplateKeys.cs @@ -28,6 +28,7 @@ static class TemplateKeys public const string GroupBoxTemplate = nameof(GroupBoxTemplate); public const string LabelTemplate = nameof(LabelTemplate); public const string ListBoxTemplate = nameof(ListBoxTemplate); + public const string ListBoxNonScrollableTemplate = nameof(ListBoxNonScrollableTemplate); public const string ListBoxItemTemplate = nameof(ListBoxItemTemplate); public const string ListBoxItemStylelessTemplate = nameof(ListBoxItemStylelessTemplate); public const string ListViewColumnHeaderTemplate = nameof(ListViewColumnHeaderTemplate); @@ -66,6 +67,7 @@ static class TemplateKeys public const string ToolTipTemplate = nameof(ToolTipTemplate); public const string TransformControlTemplate = nameof(TransformControlTemplate); public const string TreeViewTemplate = nameof(TreeViewTemplate); + public const string TreeViewNonScrollableTemplate = nameof(TreeViewNonScrollableTemplate); public const string TreeViewItemTemplate = nameof(TreeViewItemTemplate); public const string WindowXTemplate = nameof(WindowXTemplate); diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Styles/ExpanderStyle.xaml b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Styles/ExpanderStyle.xaml index d9393e30..a35fdd95 100644 --- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Styles/ExpanderStyle.xaml +++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Styles/ExpanderStyle.xaml @@ -92,6 +92,10 @@ TargetType="Expander"> + + + Value="Collapsed" /> + diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Styles/ListBoxStyle.xaml b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Styles/ListBoxStyle.xaml index 8c267b30..29e79e7d 100644 --- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Styles/ListBoxStyle.xaml +++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Styles/ListBoxStyle.xaml @@ -66,6 +66,11 @@ + + + + + + + diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/ExpanderTemplate.xaml b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/ExpanderTemplate.xaml index 3446a74a..f05433ae 100644 --- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/ExpanderTemplate.xaml +++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/ExpanderTemplate.xaml @@ -17,7 +17,6 @@ BorderThickness="{TemplateBinding BorderThickness}" Foreground="{TemplateBinding Foreground}" Source="{Binding RelativeSource={RelativeSource TemplatedParent}}" - Icon="{Binding Path=(local:ExpanderHelper.Icon), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" CornerRadius="{Binding Path=(local:ExpanderHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" Effect="{Binding Path=(i:VisualStateHelper.Effect), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" VerticalContentAlignment="Stretch" @@ -25,8 +24,9 @@ - + + + + + Grid.Row="2" + Visibility="Collapsed"> @@ -87,12 +93,18 @@ + + Value="4" /> + @@ -137,6 +149,9 @@ + @@ -149,9 +164,12 @@ - + + @@ -164,7 +182,6 @@ BorderThickness="{TemplateBinding BorderThickness}" Foreground="{TemplateBinding Foreground}" Source="{Binding RelativeSource={RelativeSource TemplatedParent}}" - Icon="{Binding Path=(local:ExpanderHelper.Icon), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" CornerRadius="{Binding Path=(local:ExpanderHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" Effect="{Binding Path=(i:VisualStateHelper.Effect), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" VerticalContentAlignment="Stretch" @@ -172,7 +189,8 @@ - + + @@ -208,6 +226,10 @@ + - + Orientation="Vertical" + HorizontalAlignment="Center" + Stroke="{Binding Path=(local:ExpanderHelper.HeaderSeparatorBrush), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" + StrokeThickness="{Binding Path=(local:ExpanderHelper.HeaderSeparatorThickness), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" + Margin="{Binding Path=(local:ExpanderHelper.HeaderSeparatorMargin), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" + Visibility="Collapsed" /> + + + @@ -227,12 +259,18 @@ + + Value="4" /> + @@ -277,6 +315,9 @@ + @@ -287,6 +328,15 @@ Property="Margin" Value="0,0,0,8" /> + + + + diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/FormGroupTemplate.xaml b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/FormGroupTemplate.xaml index 6f708c33..613fbbcc 100644 --- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/FormGroupTemplate.xaml +++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/FormGroupTemplate.xaml @@ -40,7 +40,8 @@ Grid.Row="2" Focusable="False" Visibility="Collapsed" - Margin="{TemplateBinding HeaderPadding}" + Foreground="{TemplateBinding MessageForeground}" + Margin="{TemplateBinding MessagePadding}" Content="{TemplateBinding Message}" ContentTemplate="{TemplateBinding MessageTemplate}" /> diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/ListBoxTemplate.xaml b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/ListBoxTemplate.xaml index 97faaab2..b716921b 100644 --- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/ListBoxTemplate.xaml +++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/ListBoxTemplate.xaml @@ -21,4 +21,13 @@ + + + + + + diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/TabControlTemplate.xaml b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/TabControlTemplate.xaml index cca7e090..846b8815 100644 --- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/TabControlTemplate.xaml +++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/TabControlTemplate.xaml @@ -85,6 +85,7 @@ @@ -246,6 +247,7 @@ @@ -293,7 +295,7 @@ Value="Auto" /> + Value="*" /> diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/TabItemTemplate.xaml b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/TabItemTemplate.xaml index 7836e1c3..cf410e3b 100644 --- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/TabItemTemplate.xaml +++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/TabItemTemplate.xaml @@ -26,7 +26,7 @@ Background="{Binding Path=(i:VisualStateHelper.Background), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" BorderThickness="{TemplateBinding BorderThickness}" Foreground="{Binding Path=(i:VisualStateHelper.Foreground), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" - Source="{Binding RelativeSource={RelativeSource TemplatedParent}}" + Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" Icon="{Binding Path=(local:TabItemHelper.Icon), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" IconPlacement="{Binding Path=(local:TabItemHelper.IconPlacement), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" CornerRadius="{Binding Path=(local:TabItemHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/TreeViewItemTemplate.xaml b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/TreeViewItemTemplate.xaml index d6d1da27..1d9de5e0 100644 --- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/TreeViewItemTemplate.xaml +++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Templates/TreeViewItemTemplate.xaml @@ -13,7 +13,7 @@ TargetType="TreeViewItem"> + + + + + + diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Utils/DrawingContextUtil.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Utils/DrawingContextUtil.cs new file mode 100644 index 00000000..c1a660c0 --- /dev/null +++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver.Internal/Utils/DrawingContextUtil.cs @@ -0,0 +1,25 @@ +using System.Windows; +using System.Windows.Media; + +namespace Panuon.UI.Silver.Internal.Utils +{ + static class DrawingContextUtil + { + public static void DrawLine(DrawingContext drawingContext, Pen pen, Point startPoint, Point endPoint) + { + var guidelineSet = new GuidelineSet(); + guidelineSet.GuidelinesX.Add(startPoint.X); + guidelineSet.GuidelinesY.Add(startPoint.Y); + guidelineSet.GuidelinesX.Add(endPoint.X); + guidelineSet.GuidelinesY.Add(endPoint.Y); + drawingContext.PushGuidelineSet(guidelineSet); + + var half = pen.Thickness / 2; + startPoint = new Point(startPoint.X + half, startPoint.Y + half); + endPoint = new Point(endPoint.X + half, endPoint.Y + half); + drawingContext.DrawLine(pen, startPoint, endPoint); + drawingContext.Pop(); + } + + } +} diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/Drawer.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/Drawer.cs index ec2f0a44..b6e662fa 100644 --- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/Drawer.cs +++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/Drawer.cs @@ -12,6 +12,10 @@ namespace Panuon.UI.Silver { public class Drawer : ContentControl { + #region Fields + private bool _isBound; + #endregion + #region Ctor static Drawer() { @@ -134,8 +138,10 @@ public Color? ShadowColor #region Overrides protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) { + _isBound = true; OpenOrClose(); } + #endregion #region Event Handlers @@ -163,6 +169,11 @@ private void OnLostMouseCapture(object sender, MouseButtonEventArgs e) #region Functions private void OpenOrClose() { + if (!_isBound) + { + return; + } + if (IsOpen) { if (!StaysOpen) @@ -176,7 +187,7 @@ private void OpenOrClose() case DrawerPlacement.Right: if (double.IsPositiveInfinity(MaxWidth)) { - throw new Exception("Drawer.MaxWidth must have a ensured value."); + return; } AnimationUtil.BeginDoubleAnimation(this, WidthProperty, double.IsNaN(Width) ? 0 : Width, IsOpen ? (MaxWidth - ShadowHelper.GetBlurRadius(this)) : MinWidth, IsLoaded ? AnimationDuration : TimeSpan.Zero, null, AnimationEase); break; diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/FormGroup.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/FormGroup.cs index be0196f0..daa818d0 100644 --- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/FormGroup.cs +++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/FormGroup.cs @@ -148,6 +148,17 @@ public double MaxMessageHeight DependencyProperty.Register("MaxMessageHeight", typeof(double), typeof(FormGroup), new PropertyMetadata(double.PositiveInfinity)); #endregion + #region MessageForeground + public Brush MessageForeground + { + get { return (Brush)GetValue(MessageForegroundProperty); } + set { SetValue(MessageForegroundProperty, value); } + } + + public static readonly DependencyProperty MessageForegroundProperty = + DependencyProperty.Register("MessageForeground", typeof(Brush), typeof(FormGroup)); + #endregion + #region MessagePadding public Thickness MessagePadding { diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/SeparatorX.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/SeparatorX.cs index 0c184f71..9350b921 100644 --- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/SeparatorX.cs +++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/SeparatorX.cs @@ -1,4 +1,5 @@ -using System.ComponentModel; +using Panuon.UI.Silver.Internal.Utils; +using System.ComponentModel; using System.Windows; using System.Windows.Controls; using System.Windows.Media; @@ -18,7 +19,6 @@ static SeparatorX() { IsHitTestVisibleProperty.OverrideMetadata(typeof(SeparatorX), new FrameworkPropertyMetadata(false)); FocusableProperty.OverrideMetadata(typeof(SeparatorX), new FrameworkPropertyMetadata(false)); - RenderOptions.EdgeModeProperty.OverrideMetadata(typeof(SeparatorX), new FrameworkPropertyMetadata(EdgeMode.Aliased)); } public SeparatorX() @@ -131,8 +131,6 @@ protected override Size MeasureOverride(Size availableSize) } #endregion - - #region OnRender protected override void OnRender(DrawingContext drawingContext) { @@ -142,13 +140,14 @@ protected override void OnRender(DrawingContext drawingContext) } if (_isVertical) { - drawingContext.DrawLine(_pen, new Point(StrokeThickness, 0), new Point(StrokeThickness, RenderSize.Height)); + DrawingContextUtil.DrawLine(drawingContext, _pen, new Point(0, 0), new Point(0, RenderSize.Height)); } else { - drawingContext.DrawLine(_pen, new Point(0, StrokeThickness), new Point(RenderSize.Width, StrokeThickness)); + DrawingContextUtil.DrawLine(drawingContext, _pen, new Point(0, 0), new Point(RenderSize.Width, 0)); } } + #endregion #endregion diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/Spinner.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/Spinner.cs index d0d67a1e..03920171 100644 --- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/Spinner.cs +++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Controls/Spinner.cs @@ -15,6 +15,7 @@ public class Spinner : FrameworkElement static Spinner() { DefaultStyleKeyProperty.OverrideMetadata(typeof(Spinner), new FrameworkPropertyMetadata(typeof(Spinner))); + FocusableProperty.OverrideMetadata(typeof(Spinner), new FrameworkPropertyMetadata(false)); } public Spinner() diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ListBoxHelper.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ListBoxHelper.cs index 31b3b390..f9e5be84 100644 --- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ListBoxHelper.cs +++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ListBoxHelper.cs @@ -107,6 +107,21 @@ public static void SetAutoScrollIntoView(ListBox listBox, bool value) DependencyProperty.RegisterAttached("AutoScrollIntoView", typeof(bool), typeof(ListBoxHelper), new PropertyMetadata(false, OnAutoScrollIntoViewChanged)); #endregion + #region Scrollable + public static bool GetScrollable(ListBox listBox) + { + return (bool)listBox.GetValue(ScrollableProperty); + } + + public static void SetScrollable(ListBox listBox, bool value) + { + listBox.SetValue(ScrollableProperty, value); + } + + public static readonly DependencyProperty ScrollableProperty = + DependencyProperty.RegisterAttached("Scrollable", typeof(bool), typeof(ListBoxHelper), new PropertyMetadata(true)); + #endregion + #region Items Properties #region ItemsIcon diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ToolTipHelper.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ToolTipHelper.cs index 147b1704..8ecb789d 100644 --- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ToolTipHelper.cs +++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/ToolTipHelper.cs @@ -70,6 +70,22 @@ public static void SetBorderThickness(DependencyObject obj, Thickness value) #endregion + #region FontSize + public static double GetFontSize(DependencyObject obj) + { + return (double)obj.GetValue(FontSizeProperty); + } + + public static void SetFontSize(DependencyObject obj, double value) + { + obj.SetValue(FontSizeProperty, value); + } + + public static readonly DependencyProperty FontSizeProperty = + DependencyProperty.RegisterAttached("FontSize", typeof(double), typeof(ToolTipHelper), new FrameworkPropertyMetadata(12d, FrameworkPropertyMetadataOptions.Inherits)); + + #endregion + #region Padding public static Thickness GetPadding(DependencyObject obj) { diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/TreeViewHelper.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/TreeViewHelper.cs index 8a94d813..e2a09116 100644 --- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/TreeViewHelper.cs +++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Helpers/TreeViewHelper.cs @@ -38,6 +38,21 @@ public static void SetToggleArrowPlacement(TreeView treeView, ToggleArrowPlaceme DependencyProperty.RegisterAttached("ToggleArrowPlacement", typeof(ToggleArrowPlacement), typeof(TreeViewHelper)); #endregion + #region Scrollable + public static bool GetScrollable(TreeView treeView) + { + return (bool)treeView.GetValue(ScrollableProperty); + } + + public static void SetScrollable(TreeView treeView, bool value) + { + treeView.SetValue(ScrollableProperty, value); + } + + public static readonly DependencyProperty ScrollableProperty = + DependencyProperty.RegisterAttached("Scrollable", typeof(bool), typeof(TreeViewHelper), new PropertyMetadata(true)); + #endregion + #region ItemsProperty #region ItemsIcon diff --git a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Properties/AssemblyInfo.cs b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Properties/AssemblyInfo.cs index 9e2e161b..fa571601 100644 --- a/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Properties/AssemblyInfo.cs +++ b/DotNet/WPF/Src/SharedResources/Panuon.UI.Silver/Properties/AssemblyInfo.cs @@ -49,5 +49,5 @@ //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //通过使用 "*",如下所示: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.2.13")] -[assembly: AssemblyFileVersion("2.2.13")] +[assembly: AssemblyVersion("2.2.13.2")] +[assembly: AssemblyFileVersion("2.2.13.2")]