List of value converters in Library

Full list of covnerters:
  • BooleanNegationConverter
  • BooleanToVisibilityConverter
  • DateTimeToStringConverter
  • DecimalToStringConverter
  • StringToDateTimeConverter
  • StringToDecimalConverter
  • StringToImageSourceConverter
  • StringToTimeSpanConverter
  • StringToVisibilityConverter
  • TimeSpanToDateTimeConverter
  • TimeSpanToStringConverter

Value converter usage:

1. Add namespace for add converter to resource:
<Application 
[...]
	xmlns:ValueConverters="clr-namespace:Alfa.Common.ValueConverters;assembly=Alfa.Common"
[...]
/>
[...]

2. Add to resources new converter instance:
<Application.Resources>
[...]
	<ValueConverters:StringToVisibilityConverter x:Key="StringToVisibilityConverter" />
[...]
</Application.Resources>

3. Use cenverter to convert binding value:
<TextBlock Text="I visible when I have any text" Visibility="{Binding Text, Converter={StaticResource StringToVisibilityConverter}, RelativeSource={x:Static RelativeSource.Self}}" />

Last edited Jun 20, 2013 at 9:46 AM by mklemarczyk, version 4

Comments

No comments yet.