From 17de0f7f2e9e1faf4e06e30699319eaa0579f2a0 Mon Sep 17 00:00:00 2001 From: Regynate <64607261+Regynate@users.noreply.github.com> Date: Thu, 13 Feb 2025 00:54:23 +0300 Subject: [PATCH] ConfigApp: Replace UIElement with FrameworkElement & add tooltip for Crossing Challenge (#3715) --- ConfigApp/Tabs/ChaosGrid.cs | 22 +++++++++++++++------- ConfigApp/Tabs/Settings/ModesTab.cs | 2 +- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ConfigApp/Tabs/ChaosGrid.cs b/ConfigApp/Tabs/ChaosGrid.cs index 1f1a5d19f..8a2b5d197 100644 --- a/ConfigApp/Tabs/ChaosGrid.cs +++ b/ConfigApp/Tabs/ChaosGrid.cs @@ -54,7 +54,7 @@ public void SetRowHeight(GridLength gridLength) m_RowDefinitions[m_CurrentRow].Height = gridLength; } - private void PushRow(string? text, UIElement? control) + private void PushRow(string? text, FrameworkElement? control, string? tooltip = null) { if (text != null) { @@ -70,6 +70,10 @@ private void PushRow(string? text, UIElement? control) textBlock.SetValue(Grid.ColumnProperty, m_CurrentColumn); textBlock.SetValue(Grid.RowProperty, m_CurrentRow); + if (tooltip != null) + { + textBlock.ToolTip = new ToolTip { Content = tooltip }; + } Grid.Children.Add(textBlock); m_CurrentColumn++; @@ -89,6 +93,10 @@ private void PushRow(string? text, UIElement? control) control.SetValue(Grid.ColumnProperty, m_CurrentColumn); control.SetValue(Grid.RowProperty, m_CurrentRow); + if (tooltip != null) + { + control.ToolTip = new ToolTip { Content = tooltip }; + } Grid.Children.Add(control); m_CurrentColumn++; @@ -122,12 +130,12 @@ public void PushRowEmptyPair() m_CurrentColumn += 3; } - public void PushRowElement(UIElement element) + public void PushRowElement(FrameworkElement element) { PushRow(null, element); } - public void PushRowExpandElement(UIElement element) + public void PushRowExpandElement(FrameworkElement element) { element.ClipToBounds = false; @@ -136,20 +144,20 @@ public void PushRowExpandElement(UIElement element) PushRow(null, canvas); } - public void PushRowPair(string text, UIElement element) + public void PushRowPair(string text, FrameworkElement element) { PushRow(text, element); } - public void PushRowSpacedPair(string text, UIElement element) + public void PushRowSpacedPair(string text, FrameworkElement element, string? tooltip = null) { - PushRow(text, null); + PushRow(text, null, tooltip); PushRowEmpty(); element.SetValue(FrameworkElement.HorizontalAlignmentProperty, HorizontalAlignment.Left); element.SetValue(FrameworkElement.VerticalAlignmentProperty, VerticalAlignment.Center); - PushRow(null, element); + PushRow(null, element, tooltip); } public void PushRowTextBlock(string text) diff --git a/ConfigApp/Tabs/Settings/ModesTab.cs b/ConfigApp/Tabs/Settings/ModesTab.cs index a5e7aa2b0..878815ac1 100644 --- a/ConfigApp/Tabs/Settings/ModesTab.cs +++ b/ConfigApp/Tabs/Settings/ModesTab.cs @@ -109,7 +109,7 @@ static ChaosGrid createCommonGrid() body.Children.Add(m_DistanceGrid.Grid); var footerGrid = createCommonGrid(); - footerGrid.PushRowSpacedPair("Enable Crossing Challengeā„¢", m_EnableCrossingChallenge = Utils.GenerateCommonCheckBox()); + footerGrid.PushRowSpacedPair("Enable Crossing Challengeā„¢", m_EnableCrossingChallenge = Utils.GenerateCommonCheckBox(), "Set respawn and finish points on the map. Reach the finish point without dying to win."); grid.PushRowElement(footerGrid.Grid); scrollViewer.Content = grid.Grid;