91 lines
3.4 KiB
C#
91 lines
3.4 KiB
C#
using System.Windows;
|
|
using MaterialDesignThemes.Wpf;
|
|
|
|
namespace Livia.Views.AttachedProperties;
|
|
|
|
public class MaterialTitleBarButtonProperties : DependencyObject
|
|
{
|
|
// Register an attached dependency property with the specified
|
|
// property name, property type, owner type, and property metadata.
|
|
public static readonly DependencyProperty TrueIconKindProperty =
|
|
DependencyProperty.RegisterAttached(
|
|
"TrueIconKind",
|
|
typeof(PackIconKind),
|
|
typeof(MaterialTitleBarButtonProperties),
|
|
new FrameworkPropertyMetadata(PackIconKind.QuestionMark,
|
|
FrameworkPropertyMetadataOptions.AffectsRender)
|
|
);
|
|
|
|
// Declare a get accessor method.
|
|
public static PackIconKind GetTrueIconKind(UIElement target) =>
|
|
(PackIconKind)target.GetValue(TrueIconKindProperty);
|
|
|
|
// Declare a set accessor method.
|
|
public static void SetTrueIconKind(UIElement target, PackIconKind value) =>
|
|
target.SetValue(TrueIconKindProperty, value);
|
|
|
|
|
|
|
|
// Register an attached dependency property with the specified
|
|
// property name, property type, owner type, and property metadata.
|
|
public static readonly DependencyProperty FalseIconKindProperty =
|
|
DependencyProperty.RegisterAttached(
|
|
"FalseIconKind",
|
|
typeof(PackIconKind),
|
|
typeof(MaterialTitleBarButtonProperties),
|
|
new FrameworkPropertyMetadata(PackIconKind.QuestionMark,
|
|
FrameworkPropertyMetadataOptions.AffectsRender)
|
|
);
|
|
|
|
// Declare a get accessor method.
|
|
public static PackIconKind GetFalseIconKind(UIElement target) =>
|
|
(PackIconKind)target.GetValue(FalseIconKindProperty);
|
|
|
|
// Declare a set accessor method.
|
|
public static void SetFalseIconKind(UIElement target, PackIconKind value) =>
|
|
target.SetValue(FalseIconKindProperty, value);
|
|
|
|
|
|
|
|
// Register an attached dependency property with the specified
|
|
// property name, property type, owner type, and property metadata.
|
|
public static readonly DependencyProperty IconSwitchProperty =
|
|
DependencyProperty.RegisterAttached(
|
|
"IconSwitch",
|
|
typeof(bool),
|
|
typeof(MaterialTitleBarButtonProperties),
|
|
new FrameworkPropertyMetadata(true,
|
|
FrameworkPropertyMetadataOptions.AffectsRender)
|
|
);
|
|
|
|
// Declare a get accessor method.
|
|
public static bool GetIconSwitch(UIElement target) =>
|
|
(bool)target.GetValue(IconSwitchProperty);
|
|
|
|
// Declare a set accessor method.
|
|
public static void SetIconSwitch(UIElement target, bool value) =>
|
|
target.SetValue(IconSwitchProperty, value);
|
|
|
|
// Register an attached dependency property with the specified
|
|
// property name, property type, owner type, and property metadata.
|
|
public static readonly DependencyProperty IsCloseButtonProperty =
|
|
DependencyProperty.RegisterAttached(
|
|
"IsCloseButton",
|
|
typeof(bool),
|
|
typeof(MaterialTitleBarButtonProperties),
|
|
new FrameworkPropertyMetadata(false,
|
|
FrameworkPropertyMetadataOptions.AffectsRender)
|
|
);
|
|
|
|
// Declare a get accessor method.
|
|
public static bool GetIsCloseButton(UIElement target) =>
|
|
(bool)target.GetValue(IsCloseButtonProperty);
|
|
|
|
// Declare a set accessor method.
|
|
public static void SetIsCloseButton(UIElement target, bool value) =>
|
|
target.SetValue(IsCloseButtonProperty, value);
|
|
|
|
|
|
|
|
|
|
} |