![]() When I am trying to convert, the color is coming in reverse order. Then based on the value I either return a Red or Black solidColorBrush to draw the text with on the datagrid. I need to convert the color which is stored as an integer value. This is a which has A, R, G, B properties. In the ConvertFunction I am converting the value being sent in an object to an int. You can use SolidColorBrush.Color to get or set the colour. In this case I did not implement the ConvertBack function because I am using it to change the column color. ![]() Specifically, converting from a color to a SolidColorBrush. **Here's the complete resource dictionary: And WPF offers a huge set of predefined brushes in the Brushes . Class ColorConverter Provides a way to apply custom logic to a binding. I'm guessing I've missed something, but can't figure it out. In order to work around this you must specify colours using the FromHex approach and converting as appropriate e.g. Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack In direct answer to the question, you cannot specify a x:FactoryMethod'FromRgb' in xaml for specifying colours in RGB from resources. The ColorConverter code is Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IValueConverter.Convert
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |