Skip to content

Commit

Permalink
Added tooltips in MainWindow (#428)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpeyr committed Aug 17, 2024
1 parent 7bd84fe commit f5e4b87
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
24 changes: 20 additions & 4 deletions ColorPicker/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,11 @@
FontSize="14"
Foreground="{DynamicResource Foreground1}"
RenderOptions.EdgeMode="Aliased"
Style="{StaticResource TitleBarButtonStyle}" />
Style="{StaticResource TitleBarButtonStyle}">
<Button.ToolTip>
<ToolTip x:Name="PinTooltip" Content="{x:Static lang:Resources.Pin}" />
</Button.ToolTip>
</Button>
<Button
x:Name="MinimizeBtn"
Grid.Column="3"
Expand All @@ -173,7 +177,11 @@
FontSize="14"
Foreground="{DynamicResource Foreground1}"
RenderOptions.EdgeMode="Aliased"
Style="{StaticResource TitleBarButtonStyle}" />
Style="{StaticResource TitleBarButtonStyle}">
<Button.ToolTip>
<ToolTip Content="{x:Static lang:Resources.Minimize}" />
</Button.ToolTip>
</Button>
<Button
x:Name="MaximizeRestoreBtn"
Grid.Column="4"
Expand All @@ -186,7 +194,11 @@
FontSize="14"
Foreground="{DynamicResource Foreground1}"
RenderOptions.EdgeMode="Aliased"
Style="{StaticResource TitleBarButtonStyle}" />
Style="{StaticResource TitleBarButtonStyle}">
<Button.ToolTip>
<ToolTip x:Name="MaximizeTooltip" Content="{x:Static lang:Resources.Maximize}" />
</Button.ToolTip>
</Button>
<Button
x:Name="CloseBtn"
Grid.Column="5"
Expand All @@ -199,7 +211,11 @@
FontSize="14"
Foreground="{DynamicResource Foreground1}"
RenderOptions.EdgeMode="Aliased"
Style="{StaticResource TitleBarCloseButtonStyle}" />
Style="{StaticResource TitleBarCloseButtonStyle}">
<Button.ToolTip>
<ToolTip Content="{x:Static lang:Resources.Close}" />
</Button.ToolTip>
</Button>
</Grid>
</Border>
<Border Grid.Row="1" Style="{StaticResource WindowMainPanelStyle}">
Expand Down
6 changes: 5 additions & 1 deletion ColorPicker/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ private void InitUI()
AppPages.ContrastGrid => Global.ContrastPage,
_ => Global.HomePage
});
PinTooltip.Content = Topmost ? Properties.Resources.Unpin : Properties.Resources.Pin;
}

private void PageCard_OnCardClick(object? sender, PageEventArgs e)
Expand Down Expand Up @@ -257,6 +258,7 @@ private void PinBtn_Click(object sender, RoutedEventArgs e)
{
Topmost = !Topmost; // Toggle
PinBtn.Content = Topmost ? "\uF604" : "\uF602"; // Set text
PinTooltip.Content = Topmost ? Properties.Resources.Unpin : Properties.Resources.Pin;
}

private void HandleWindowStateChanged()
Expand All @@ -267,7 +269,9 @@ private void HandleWindowStateChanged()
MaximizeRestoreBtn.FontSize = WindowState == WindowState.Maximized
? 18
: 14;

MaximizeTooltip.Content = WindowState == WindowState.Maximized
? Properties.Resources.Restore // Restore icon
: Properties.Resources.Maximize; // Maximize icon
DefineMaximumSize();

WindowBorder.Margin = WindowState == WindowState.Maximized ? new(10, 10, 0, 0) : new(10); // Set
Expand Down

0 comments on commit f5e4b87

Please sign in to comment.