diff --git a/demo/Ursa.Demo/Views/MainView.axaml b/demo/Ursa.Demo/Views/MainView.axaml index 9e31e57..e01f3f1 100644 --- a/demo/Ursa.Demo/Views/MainView.axaml +++ b/demo/Ursa.Demo/Views/MainView.axaml @@ -22,8 +22,7 @@ + ColumnDefinitions="Auto, *" > + + + + + + + diff --git a/src/Ursa.Themes.Semi/Controls/_index.axaml b/src/Ursa.Themes.Semi/Controls/_index.axaml index 4d7ae82..4ecab88 100644 --- a/src/Ursa.Themes.Semi/Controls/_index.axaml +++ b/src/Ursa.Themes.Semi/Controls/_index.axaml @@ -43,6 +43,7 @@ + diff --git a/src/Ursa/Controls/TitleBar/CaptionButtons.cs b/src/Ursa/Controls/TitleBar/CaptionButtons.cs new file mode 100644 index 0000000..2ff0aeb --- /dev/null +++ b/src/Ursa/Controls/TitleBar/CaptionButtons.cs @@ -0,0 +1,75 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Controls.Metadata; +using Avalonia.Controls.Primitives; +using Irihi.Avalonia.Shared.Helpers; +using Irihi.Avalonia.Shared.Reactive; + +namespace Ursa.Controls; + +[TemplatePart(PART_CloseButton, typeof (Button))] +[TemplatePart(PART_RestoreButton, typeof (Button))] +[TemplatePart(PART_MinimizeButton, typeof (Button))] +[TemplatePart(PART_FullScreenButton, typeof (Button))] +[PseudoClasses(":minimized", ":normal", ":maximized", ":fullscreen")] +public class CaptionButtons: Avalonia.Controls.Chrome.CaptionButtons +{ + private const string PART_CloseButton = "PART_CloseButton"; + private const string PART_RestoreButton = "PART_RestoreButton"; + private const string PART_MinimizeButton = "PART_MinimizeButton"; + private const string PART_FullScreenButton = "PART_FullScreenButton"; + + private Button? _closeButton; + private Button? _restoreButton; + private Button? _minimizeButton; + private Button? _fullScreenButton; + + private IDisposable? _visibilityDisposable; + + protected override void OnApplyTemplate(TemplateAppliedEventArgs e) + { + _closeButton = e.NameScope.Get