Tuesday, August 08, 2006

An article has just been published on code project by Josh Smith that should not escape your attention: Piping value converters in WPF.

Basically, he has written a simple class that will allow you to define a group of converters and use it during databinding like so:
    <local:ValueConverterGroup x:Key="statusForegroundGroup">
      <local:IntegerStringToProcessingStateConverter  />
      <local:ProcessingStateToColorConverter />
      <local:ColorToSolidColorBrushConverter />
    </local:
ValueConverterGroup>

and then use it like so:

        <TextBlock
          Text="{Binding XPath=@Status,
                 Converter={StaticResource statusDisplayNameGroup}}"

          Foreground="{Binding XPath=@Status,
                       Converter={StaticResource statusForegroundGroup}}"
/>

This should prove very valuable indeed!

Monday, May 24, 2010 9:03:08 AM (Romance Standard Time, UTC+01:00)
cheap mbt shoes online seller.
Comments are closed.