From 80d47cf18f732f1e9305ec0c21813f8869dd3d30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Peyronnet?= Date: Sun, 17 Mar 2024 13:56:40 +0100 Subject: [PATCH] Added the possibility to highlight selected color in Grid (#398) --- ColorPicker/Pages/ContrastPage.xaml | 1 - ColorPicker/Pages/ContrastPage.xaml.cs | 28 +++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/ColorPicker/Pages/ContrastPage.xaml b/ColorPicker/Pages/ContrastPage.xaml index 4d6dc17..04e54e8 100644 --- a/ColorPicker/Pages/ContrastPage.xaml +++ b/ColorPicker/Pages/ContrastPage.xaml @@ -432,7 +432,6 @@ Style="{DynamicResource DefaultToggleButton}" /> - diff --git a/ColorPicker/Pages/ContrastPage.xaml.cs b/ColorPicker/Pages/ContrastPage.xaml.cs index 36b51d7..6529c75 100644 --- a/ColorPicker/Pages/ContrastPage.xaml.cs +++ b/ColorPicker/Pages/ContrastPage.xaml.cs @@ -408,6 +408,33 @@ internal void InitGrid(double limit) } } + + Border ColBorder = new() + { + Name = "ColBorder", + BorderBrush = Global.GetColorFromResource("AccentColor"), + BorderThickness = new Thickness(2), + CornerRadius = new CornerRadius(5) + }; + + Border RowBorder = new() + { + Name = "RowBorder", + BorderBrush = Global.GetColorFromResource("AccentColor"), + BorderThickness = new Thickness(2), + CornerRadius = new CornerRadius(5) + }; + + Grid.SetColumn(ColBorder, 11-lumValues.IndexOf(ColorInfo.HSL.L) ); + Grid.SetRow(RowBorder, 11-lumValues.IndexOf(ColorInfo.HSL.L)); + Grid.SetRowSpan(ColBorder, 12); + Grid.SetColumnSpan(RowBorder, 12); + Panel.SetZIndex(ColBorder, 10); + Panel.SetZIndex(RowBorder, 10); + + ContrastGrid.Children.Add(ColBorder); + ContrastGrid.Children.Add(RowBorder); + // Load the bookmark icon if (!Global.Bookmarks.ColorBookmarks.Contains($"#{ColorInfo.HEX.Value}")) { @@ -417,7 +444,6 @@ internal void InitGrid(double limit) } BookmarkBtn.Content = "\uF1F8"; BookmarkToolTip.Content = Properties.Resources.RemoveBookmark; - } private void ScoreAllToggle_Checked(object sender, RoutedEventArgs e)