Skip to content

Conversation

@jpk6789
Copy link

@jpk6789 jpk6789 commented Oct 26, 2025

The current color controls keep their state even if they are disabled. However, this can be confusing for users because there is no visual feedback that the controls are disabled. This PR changes this behavior by using the luminance of a color as the gray value.

Enabled Controls

grafik

Disabled Controls

grafik

Breaking Changes

This PR changes the visual behavior of the color controls so if developers used the disabled state to just display the color, this PR will break this. However, I would argue that the color controls are primarily to control the color values and not just to display them. If such a display option is needed, an additional "KeepColorWhileDisabled" DP could be added to the controls.

Copy link
Member

@flabbet flabbet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks like it should work, but I tried running ColorPickerDemo and changed IsEnabled=False on StandardColorPicker PortableColorPicker, but nothing grayed out. Is there something I am missing out?

@jpk6789
Copy link
Author

jpk6789 commented Dec 9, 2025

Uhm I set IsEnabled=False on the MainWindow and then it worked for me. I tried that now again. But I will check it why this could not work.

Edit: Ah ok, I think I know the issue. I updated the WPF controls but not the AvaloniaUI controls. I will fix and commit that.

@jpk6789
Copy link
Author

jpk6789 commented Dec 10, 2025

Ok, it was actually as I thought: I forgot to also implement this feature in the AvaloniaUI control. Now they also gray out if they are disabled.

@flabbet
Copy link
Member

flabbet commented Dec 11, 2025

The issue is not related to Avalonia. I tested WPF demo project. Although thank you for implementing that too. My problem was that setting IsEnabled to individual controls do not make them grayed out. I did not test setting IsEnabled to whole window. I'll check if everything works with avalonia later

@jpk6789
Copy link
Author

jpk6789 commented Dec 11, 2025

Ahh ok. Then I will check that again if I missed something.

@jpk6789
Copy link
Author

jpk6789 commented Dec 11, 2025

Uhm I now tried it again with WPF and I was able to disable some of the controls (also tested with different .Net versions). So actually I am a bit confused, why it does not work for you.
PartiallyDisabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants