Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crossing Challenge: add tooltip #3715

Merged
merged 1 commit into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions ConfigApp/Tabs/ChaosGrid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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++;
Expand All @@ -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++;
Expand Down Expand Up @@ -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;

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion ConfigApp/Tabs/Settings/ModesTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down