I wrote a converter that get
Value
asBool
Parameter
asString
I use it like this:
BorderBrush="{Binding IsSelected,
Converter={StaticResource BoolToColorBrushConverter},
ConverterParameter='#ff00bfff;#0000bfff'}"
If Value
is True
then the converter return a ColorBrush
from first color Hex code in Parameter else return a ColorBrush
from second color hex code.
My converter work very well But I want know how can i use it like this:
<Color x:Key="MyColor1">#66bb66</Color>
--------------------
BorderBrush="{Binding IsSelected,
Converter={StaticResource BoolToColorBrushConverter},
ConverterParameter=#ff00bfff;{StaticResource MyColor1}}"
Result in Design mode:
Result at RunTime:
But i need color Hex code of the StaticResource
in my parameter like this:
Parameter: "#ff00bfff;#66bb66"
My question is how can i pass a StaticResource
value in a combine string to my ConverterParameter
???
What is your solution?
I know it's a bit late, but hopefully this can help the late visitors:
here is the converter code:
then you can configure the converter in xaml like this (in the ResourceDictionary section):
and this is how you use the converter: