整理
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
using NeumUI.Assets;
|
||||
using NeumUI.Controls;
|
||||
using NeoUI.Assets;
|
||||
using NeoUI.Controls;
|
||||
|
||||
namespace NeumUI.Assists;
|
||||
namespace NeoUI.Assists;
|
||||
|
||||
/// <summary>
|
||||
/// ButtonAssist 类提供了对按钮控件外观类型的辅助功能。
|
||||
@@ -37,37 +37,81 @@ public class ButtonAssist
|
||||
public static readonly DependencyProperty AppearanceTypeProperty =
|
||||
DependencyProperty.RegisterAttached("AppearanceType", typeof(AppearanceType), typeof(ButtonAssist), new PropertyMetadata(AppearanceType.None));
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定对象的图标。
|
||||
/// </summary>
|
||||
/// <param name="obj">要获取其图标的依赖对象。</param>
|
||||
/// <returns>返回指定对象的MaterialSymbol枚举值,表示其图标。</returns>
|
||||
public static MaterialSymbol GetIcon(DependencyObject obj)
|
||||
{
|
||||
return (MaterialSymbol)obj.GetValue(IconProperty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为指定对象设置图标。
|
||||
/// </summary>
|
||||
/// <param name="obj">要为其设置图标的依赖对象。</param>
|
||||
/// <param name="value">要设置的MaterialSymbol图标值。</param>
|
||||
public static void SetIcon(DependencyObject obj, MaterialSymbol value)
|
||||
{
|
||||
obj.SetValue(IconProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 代表按钮控件的图标依赖属性。通过此属性,可以设置或获取按钮上显示的图标。
|
||||
/// 支持使用MaterialSymbol枚举中的值来指定具体的图标样式。
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IconProperty =
|
||||
DependencyProperty.RegisterAttached("Icon", typeof(MaterialSymbol), typeof(ButtonAssist), new PropertyMetadata(MaterialSymbol.Cr));
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定对象的图标放置位置。
|
||||
/// </summary>
|
||||
/// <param name="obj">要获取其图标放置位置的依赖对象。</param>
|
||||
/// <returns>返回指定对象的Dock枚举值,表示图标的放置位置。</returns>
|
||||
public static Dock GetIconPlacement(DependencyObject obj)
|
||||
{
|
||||
return (Dock)obj.GetValue(IconPlacementProperty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置指定对象的图标放置位置。
|
||||
/// </summary>
|
||||
/// <param name="obj">要设置其图标放置位置的依赖对象。</param>
|
||||
/// <param name="value">图标放置位置的值,使用Dock枚举表示。</param>
|
||||
public static void SetIconPlacement(DependencyObject obj, Dock value)
|
||||
{
|
||||
obj.SetValue(IconPlacementProperty, value);
|
||||
}
|
||||
|
||||
// Using a DependencyProperty as the backing store for IconPlacement. This enables animation, styling, binding, etc...
|
||||
|
||||
/// <summary>
|
||||
/// 代表按钮控件的图标位置依赖属性。通过此属性,可以设置或获取按钮上图标的放置位置。
|
||||
/// 支持使用Dock枚举中的值来指定图标相对于按钮文本的位置,例如左对齐、右对齐等。
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IconPlacementProperty =
|
||||
DependencyProperty.RegisterAttached("IconPlacement", typeof(Dock), typeof(ButtonAssist), new PropertyMetadata(Dock.Left));
|
||||
|
||||
/// <summary>
|
||||
/// 代表按钮控件是否正在运行的依赖属性。通过此属性,可以设置或获取按钮的运行状态。
|
||||
/// 此属性通常用于指示按钮关联的操作是否正在进行中,例如数据加载或处理过程。
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IsRunningProperty =
|
||||
DependencyProperty.RegisterAttached("IsRunning", typeof(bool), typeof(ButtonAssist), new PropertyMetadata(false));
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定对象的IsRunning状态。
|
||||
/// </summary>
|
||||
/// <param name="obj">要获取其IsRunning状态的依赖对象。</param>
|
||||
/// <returns>返回一个布尔值,表示指定对象是否正在运行。</returns>
|
||||
public static bool GetIsRunning(DependencyObject obj) => (bool)obj.GetValue(IsRunningProperty);
|
||||
|
||||
/// <summary>
|
||||
/// 设置指定对象的运行状态。
|
||||
/// </summary>
|
||||
/// <param name="obj">要设置其运行状态的依赖对象。</param>
|
||||
/// <param name="value">布尔值,表示对象是否处于运行状态。</param>
|
||||
public static void SetIsRunning(DependencyObject obj, bool value) => obj.SetValue(IsRunningProperty, value);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user