From a7aeb6d1dd3b2456b4a2601189eaab387fde41b2 Mon Sep 17 00:00:00 2001 From: Lesueur Benjamin Date: Thu, 23 Nov 2023 16:14:10 +0100 Subject: [PATCH] improve IController userIndex display --- .../Controllers/IController.xaml | 20 +++++++++++++------ .../Controllers/IController.xaml.cs | 18 ++++++++++++++--- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/HandheldCompanion/Controllers/IController.xaml b/HandheldCompanion/Controllers/IController.xaml index 81db479b2..595e0f0fd 100644 --- a/HandheldCompanion/Controllers/IController.xaml +++ b/HandheldCompanion/Controllers/IController.xaml @@ -30,13 +30,21 @@ FontSize="30" Glyph="␼" /> - + - + + + + + + + + + + + + + diff --git a/HandheldCompanion/Controllers/IController.xaml.cs b/HandheldCompanion/Controllers/IController.xaml.cs index 9474fced3..04d535e3b 100644 --- a/HandheldCompanion/Controllers/IController.xaml.cs +++ b/HandheldCompanion/Controllers/IController.xaml.cs @@ -111,13 +111,25 @@ protected byte UserIndex } set { + _UserIndex = value; + // UI thread (async) Application.Current.Dispatcher.BeginInvoke(() => { - ControllerIndex.Text = string.Format(Properties.Resources.IController_ControllerIndex, (UserIndex)value); + foreach(FrameworkElement frameworkElement in UserIndexPanel.Children) + { + if (frameworkElement is not Border) + continue; + + Border border = (Border)frameworkElement; + int idx = UserIndexPanel.Children.IndexOf(border); + + if (idx == value) + border.SetResourceReference(BackgroundProperty, "AccentAAFillColorDefaultBrush"); + else + border.SetResourceReference(BackgroundProperty, "SystemControlForegroundBaseLowBrush"); + } }); - - _UserIndex = value; } }