fix: Fix model picker icon theme switching and line-numbers Name length - #618
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves runtime UI correctness and accessibility in AI Dev Gallery by ensuring model picker icons update when the app theme changes, and by preventing an excessively long UIA Name for the line-numbers pane.
Changes:
- Made
ModelPickerDefinition.Iconobservable and switched the model picker icon binding toOneWay, enabling runtime updates. - Centralized themed icon path updates in
ModelPickerDefinition.RefreshThemeAwareIcons()and invoked it on theme/resource changes and when the picker loads models. - Fixed the line-numbers pane’s UIA Name length by naming the
ScrollViewerand marking the decorative digits asAccessibilityView="Raw".
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| AIDevGallery/MainWindow.xaml.cs | Refreshes theme-aware model picker icons during resource updates triggered by theme/high-contrast changes. |
| AIDevGallery/Controls/SampleContainer.xaml | Adds an explicit UIA name for the line-numbers scroller and hides decorative line-number text from accessibility. |
| AIDevGallery/Controls/ModelPicker/ModelPickerViews/ModelPickerDefinitions.cs | Makes Icon raise change notifications and adds a centralized theme-aware icon refresh helper. |
| AIDevGallery/Controls/ModelPicker/ModelOrApiPicker.xaml.cs | Refreshes themed icon paths on ActualThemeChanged and when loading models. |
| AIDevGallery/Controls/ModelPicker/ModelOrApiPicker.xaml | Updates the icon binding to OneWay so Icon changes propagate to the UI. |
weiyuanyue
approved these changes
Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. Model picker icons don't update on runtime theme switch
The OpenAI / Custom models / Ollama icons were bound
OneTimeto paths computed once, so toggling the Windows theme at runtime left them stale (low-contrast in dark/light). MadeModelPickerDefinition.Iconobservable +OneWay, and refresh the themed paths onActualThemeChanged/ picker open /ColorValuesChanged.2. Line-numbers pane UIA Name > 512 chars
The line-numbers
ScrollViewerhad no explicit Name, so UIA concatenated every line number ("1 2 3 …"). AddedAutomationProperties.Name="Line numbers"to the pane and excluded the decorative digits (AccessibilityView="Raw").Verified with Accessibility Insights and runtime theme toggling; builds clean.