月更
This commit is contained in:
51
AntDesignWPF/Helpers/TabControlHelper.cs
Normal file
51
AntDesignWPF/Helpers/TabControlHelper.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AntDesignWPF.Helpers;
|
||||
public enum TabType
|
||||
{
|
||||
Line, // 默认线条样式
|
||||
Card // 卡片样式
|
||||
}
|
||||
|
||||
public class TabControlHelper : DependencyObject
|
||||
{
|
||||
// 注册 TabType 附加属性
|
||||
public static readonly DependencyProperty TabTypeProperty =
|
||||
DependencyProperty.RegisterAttached(
|
||||
"TabType",
|
||||
typeof(TabType),
|
||||
typeof(TabControlHelper),
|
||||
new PropertyMetadata(TabType.Line)); // 默认值为 Line
|
||||
|
||||
public static void SetTabType(DependencyObject element, TabType value)
|
||||
{
|
||||
element.SetValue(TabTypeProperty, value);
|
||||
}
|
||||
|
||||
public static TabType GetTabType(DependencyObject element)
|
||||
{
|
||||
return (TabType)element.GetValue(TabTypeProperty);
|
||||
}
|
||||
|
||||
// 注册 IsEditable 附加属性
|
||||
public static readonly DependencyProperty IsEditableProperty =
|
||||
DependencyProperty.RegisterAttached(
|
||||
"IsEditable",
|
||||
typeof(bool),
|
||||
typeof(TabControlHelper),
|
||||
new PropertyMetadata(false));
|
||||
|
||||
public static void SetIsEditable(DependencyObject element, bool value)
|
||||
{
|
||||
element.SetValue(IsEditableProperty, value);
|
||||
}
|
||||
|
||||
public static bool GetIsEditable(DependencyObject element)
|
||||
{
|
||||
return (bool)element.GetValue(IsEditableProperty);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user