76 lines
2.2 KiB
C#
Raw Permalink Normal View History

2023-05-11 23:11:39 -04:00
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.Media;
using System.Windows.Input;
namespace SPTInstaller.CustomControls;
public partial class TitleBar : UserControl
2023-05-11 23:11:39 -04:00
{
public TitleBar()
2023-05-11 23:11:39 -04:00
{
InitializeComponent();
}
2023-05-11 23:11:39 -04:00
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
2023-05-11 23:11:39 -04:00
public static readonly StyledProperty<string> TitleProperty =
AvaloniaProperty.Register<TitleBar, string>(nameof(Title));
2023-05-11 23:11:39 -04:00
public string Title
{
get => GetValue(TitleProperty);
set => SetValue(TitleProperty, value);
}
2023-05-11 23:11:39 -04:00
public static readonly StyledProperty<IBrush> ButtonForegroundProperty =
AvaloniaProperty.Register<TitleBar, IBrush>(nameof(ButtonForeground));
2023-05-11 23:11:39 -04:00
public IBrush ButtonForeground
{
get => GetValue(ButtonForegroundProperty);
set => SetValue(ButtonForegroundProperty, value);
}
2023-05-11 23:11:39 -04:00
public static new readonly StyledProperty<IBrush> ForegroundProperty =
AvaloniaProperty.Register<TitleBar, IBrush>(nameof(Foreground));
2023-05-11 23:11:39 -04:00
public new IBrush Foreground
{
get => GetValue(ForegroundProperty);
set => SetValue(ForegroundProperty, value);
}
2023-05-11 23:11:39 -04:00
public static new readonly StyledProperty<IBrush> BackgroundProperty =
AvaloniaProperty.Register<TitleBar, IBrush>(nameof(Background));
2023-05-11 23:11:39 -04:00
public new IBrush Background
{
get => GetValue(BackgroundProperty);
set => SetValue(BackgroundProperty, value);
}
2023-05-11 23:11:39 -04:00
//Close Button Command (X Button) Property
public static readonly StyledProperty<ICommand> XButtonCommandProperty =
AvaloniaProperty.Register<TitleBar, ICommand>(nameof(XButtonCommand));
2023-05-11 23:11:39 -04:00
public ICommand XButtonCommand
{
get => GetValue(XButtonCommandProperty);
set => SetValue(XButtonCommandProperty, value);
}
2023-05-11 23:11:39 -04:00
//Minimize Button Command (- Button) Property
public static readonly StyledProperty<ICommand> MinButtonCommandProperty =
AvaloniaProperty.Register<TitleBar, ICommand>(nameof(MinButtonCommand));
2023-05-11 23:11:39 -04:00
public ICommand MinButtonCommand
{
get => GetValue(MinButtonCommandProperty);
set => SetValue(MinButtonCommandProperty, value);
2023-05-11 23:11:39 -04:00
}
}