From 212c8ec2093b41f321e7c424903ff7a7819ae30a Mon Sep 17 00:00:00 2001 From: Xjph Date: Sun, 24 Oct 2021 12:34:30 -0230 Subject: [PATCH] Add "action" setting type to create buttons. --- ObservatoryCore/UI/Views/BasicUIView.axaml.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ObservatoryCore/UI/Views/BasicUIView.axaml.cs b/ObservatoryCore/UI/Views/BasicUIView.axaml.cs index ba33d0f..ab70626 100644 --- a/ObservatoryCore/UI/Views/BasicUIView.axaml.cs +++ b/ObservatoryCore/UI/Views/BasicUIView.axaml.cs @@ -925,6 +925,21 @@ namespace Observatory.UI.Views settingsGrid.AddControl(stackPanel, settingsGrid.RowDefinitions.Count - 1, 0, 2); settingsGrid.AddControl(settingBrowse, settingsGrid.RowDefinitions.Count - 1, 2); + break; + case Action action: + Button actionButton = new() + { + Content = label.Text, + HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Left + }; + + actionButton.Click += (object sender, RoutedEventArgs e) => + { + action.Invoke(); + }; + + settingsGrid.AddControl(actionButton, settingsGrid.RowDefinitions.Count - 1, 0); + break; } }