fluentribbon / Fluent.Ribbon

WPF Ribbon control like in Office
http://fluentribbon.github.io
MIT License
2.55k stars 517 forks source link

Custom color does not reset color gallery selection state #918

Closed nativenolde closed 3 years ago

nativenolde commented 3 years ago

Hi @batzen,

we noticed that if the selected color is set (using code) to a custom one, that is not part of the gallery items, the selection state gets not reset. as you can see below, the selection state will reset only if there is a color match:

https://github.com/fluentribbon/Fluent.Ribbon/blob/044e23df7eb4c7397f244b62b5c53d26d15a2bed/Fluent.Ribbon/Controls/ColorGallery.cs#L528-L543

in our use case, we have a lot of fancy rich text content with some custom colorings, that are not introduced by the color gallery, but from external content creators using their own tooling. so let's assume a user writes some text and changes the fore color to red and moves to a fragment that has a custom fore color... then the red color gallery list-box-item is still selected, even if we set the selected color of the color gallery to the custom one.

i hope that this is an issue and not the intended behaviour, so that it can be fixed.

Sincerely yours

nativenolde commented 3 years ago

My workaround is to set the selected color first to null, which will reset the selection state, and then the actual (custom) color.

batzen commented 3 years ago

Will have a look and fix the issue.