I need to present System.Windows.Media.Color
in a TextBlock
formatted as hexadecimal #rrggbb
. Binding a color like
<TextBlock Text="{Binding Color}"/>
results in a string formatted like #aarrggbb
. I know I could create my own converter to get the desired format, but I don't like the effort. I wondered if there is no other, much simpler way.
I know, defining formats of a DateTime
could be easily done like
StringFormat={}{0:HH:mm}
Similar to this solution I tried
StringFormat={}{0:#rrggbb}
but the result is
sc#1rrggbb, rrggbb, 1rrggbb, 1rrggbb
Is there a way to use StringFormat
to format the color? If yes, whats the corret syntax?