Converter
used together with a Binding
, quote from MSDN
:
IValueConverter:
Provides a way to apply custom logic to aBinding
.If you want to associate a value converter with a
Binding
, create a class that implements theIValueConverter
interface and then implement the Convert and ConvertBack methods.
Therefore, you need to write this:
<TextBlock Text="{Binding Path=value1, Converter={StaticResource myEnumToString}}" ... />
If this values located in ItemSource
or for root Control defined DataContext
, try this:
<TextBlock Text="{Binding Converter={StaticResource myEnumToString}}" ... />
Either like this:
<TextBlock Text="{Binding Path=., Converter={StaticResource myEnumToString}}" ... />
In this case, Text="{Binding Path=.}"
is equivalent to Text="{Binding}"
.