From db2403a72f72170851d12ff0a113f57c1f6cda1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E7=BA=A2=E5=B8=BD?= <761716178@qq.com> Date: Thu, 19 Sep 2024 22:05:56 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=B8=8D=E5=90=8C=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E8=AF=AD=E8=A8=80=E4=B8=8B=E5=B1=9E=E6=80=A7=E8=AF=BB?= =?UTF-8?q?=E5=8F=96=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CPF/Controls/TreeViewItem.cs | 2 +- CPF/CpfObject.cs | 2 +- CPF/UIElement.cs | 32 ++++++++++++++++++-------------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/CPF/Controls/TreeViewItem.cs b/CPF/Controls/TreeViewItem.cs index b15942b..c08c38e 100644 --- a/CPF/Controls/TreeViewItem.cs +++ b/CPF/Controls/TreeViewItem.cs @@ -30,7 +30,7 @@ namespace CPF.Controls public bool IsSelected { get { return GetValue(); } - internal set { SetValue(value); } + set { SetValue(value); } } /// /// 获取或设置标记控件的项 diff --git a/CPF/CpfObject.cs b/CPF/CpfObject.cs index 8a80396..c7fe291 100644 --- a/CPF/CpfObject.cs +++ b/CPF/CpfObject.cs @@ -346,7 +346,7 @@ namespace CPF List propertyList = new List(); var list = type.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic); - list = list.OrderBy(a => a, new TypeCompar()).ThenBy(a => a.Name).ToArray(); + list = list.OrderBy(a => a, new TypeCompar()).ThenBy(a => a.Name, StringComparer.Ordinal).ToArray(); OverrideMetadata om = new OverrideMetadata(); OnOverrideMetadata(om); diff --git a/CPF/UIElement.cs b/CPF/UIElement.cs index 05efc51..6a09f0e 100644 --- a/CPF/UIElement.cs +++ b/CPF/UIElement.cs @@ -373,8 +373,8 @@ namespace CPF [Description("键盘焦点")] public bool IsKeyboardFocused { - get { return (bool)GetValue(21); } - private set { SetValue(value, 21); } + get { return (bool)GetValue(22); } + private set { SetValue(value, 22); } } /// /// 获取一个值,该值指示键盘焦点是否位于元素或其可视化树子元素内的任意位置 @@ -383,8 +383,8 @@ namespace CPF [Description("获取一个值,该值指示键盘焦点是否位于元素或其可视化树子元素内的任意位置")] public bool IsKeyboardFocusWithin { - get { return (bool)GetValue(22); } - private set { SetValue(value, 22); } + get { return (bool)GetValue(21); } + private set { SetValue(value, 21); } } /// /// 获取焦点的导航方式 @@ -393,8 +393,8 @@ namespace CPF [PropertyMetadata(null)] public NavigationMethod? FocusMethod { - get { return (NavigationMethod?)GetValue(14); } - private set { SetValue(value, 14); } + get { return (NavigationMethod?)GetValue(13); } + private set { SetValue(value, 13); } } /// @@ -404,8 +404,8 @@ namespace CPF [PropertyMetadata(false)] public bool Focusable { - get { return GetValue(10); } - set { SetValue(value, 10); } + get { return GetValue(14); } + set { SetValue(value, 14); } } /// @@ -444,8 +444,8 @@ namespace CPF [PropertyMetadata(typeof(ViewFill), "#000")] public ViewFill FocusFrameFill { - get { return GetValue(11); } - set { SetValue(value, 11); } + get { return GetValue(10); } + set { SetValue(value, 10); } } /// /// 按tab键切换焦点显示的聚焦框 @@ -454,8 +454,8 @@ namespace CPF [PropertyMetadata(typeof(Stroke), "1,Dash")] public Stroke FocusFrameStroke { - get { return GetValue(13); } - set { SetValue(value, 13); } + get { return GetValue(12); } + set { SetValue(value, 12); } } /// /// 聚焦框到元素边缘距离 @@ -463,8 +463,8 @@ namespace CPF [UIPropertyMetadata(typeof(Thickness), "3", UIPropertyOptions.AffectsRender), Description("聚焦框到元素边缘距离")] public Thickness FocusFramePadding { - get { return GetValue(12); } - set { SetValue(value, 12); } + get { return GetValue(11); } + set { SetValue(value, 11); } } /// @@ -1053,6 +1053,10 @@ namespace CPF toolTipElement.Dispose(); toolTipElement = null; } + if (newValue is string str && string.IsNullOrEmpty(str)) + { + return; + } if (newValue != null) { UIElement element = newValue as UIElement;