Simplify ColorPicker and ColorView via shared abstract base class#2
Draft
Copilot wants to merge 3 commits into
Draft
Simplify ColorPicker and ColorView via shared abstract base class#2Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
…r to share base class, simplify ColorPicker templates Agent-Logs-Url: https://github.com/irihitech/Avalonia/sessions/b3aced6b-b243-485a-8949-c94bc7b8724c Co-authored-by: rabbitism <14807942+rabbitism@users.noreply.github.com>
Agent-Logs-Url: https://github.com/irihitech/Avalonia/sessions/b3aced6b-b243-485a-8949-c94bc7b8724c Co-authored-by: rabbitism <14807942+rabbitism@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor ColorPicker and ColorView for shared base class
Simplify ColorPicker and ColorView via shared abstract base class
Apr 6, 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.
ColorPickerinherited fromColorViewand its template was a ~500-line verbatim copy of theColorViewtemplate embedded in a flyout — with a comment literally saying "It MUST always be kept in sync with the ColorView".Changes
New
ColorPickerBaseabstract classStyledPropertydefinitions (Color,HsvColor,Palette,PaletteColors,SelectedIndex, allIs*Visibleflags, etc.) intoColorPickerBase.Properties.csColorChangedevent,OnColorChanged, and all shared property-sync logic (Color↔HsvColor, Palette→PaletteColors, alpha coercion) intoColorPickerBase.csColorView→ extendsColorPickerBasePART_HexTextBox,PART_TabControl,ValidateSelection, hex input handlersColorView.Properties.csemptied (all properties now in base class)ColorPicker→ extendsColorPickerBase(no longerColorView)Content,ContentTemplate,HorizontalContentAlignment,VerticalContentAlignment[TemplatePart("PART_ColorView", typeof(ColorView))]Simplified ColorPicker templates (both Simple and Fluent)
~500 lines of duplicated XAML reduced to ~99 lines using
<ColorView>as the inner flyout element with bindings:ColorandSelectedIndexare TwoWay so user interactions propagate back to theColorPicker. All configuration properties use one-wayTemplateBinding. TheColorViewTabBackgroundCornerRadiusresource is overridden locally per-theme to maintain flyout-appropriate styling.