livia-test/Livia/Views/AttachedProperties/StringItemProperties.cs
2025-03-28 14:31:53 +08:00

25 lines
896 B
C#

using System.Windows;
namespace Livia.Views.AttachedProperties;
public class StringItemProperties : DependencyObject
{
// Register an attached dependency property with the specified
// property name, property type, owner type, and property metadata.
public static readonly DependencyProperty ItemNameProperty =
DependencyProperty.RegisterAttached(
"ItemName",
typeof(string),
typeof(StringItemProperties),
new FrameworkPropertyMetadata("",
FrameworkPropertyMetadataOptions.AffectsRender)
);
// Declare a get accessor method.
public static string GetItemName(UIElement target) =>
(string)target.GetValue(ItemNameProperty);
// Declare a set accessor method.
public static void SetItemName(UIElement target, string value) =>
target.SetValue(ItemNameProperty, value);
}