Synergist.DateTimeConverter

Value converter that converts DateTime values into strings using a formatting paramter
The ConverterParameter is a standard or custom date and time format string.

Sample

This is from the Me Sample in the Kit
<UserControl x:Class="Me.Page"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:MyOpenSpace="clr-namespace:MyOpenSpace;assembly=MySpaceSilverlightKit"             
  xmlns:Synergist="clr-namespace:Synergist;assembly=MySpaceSilverlightKit"             
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <UserControl.Resources>
        <MyOpenSpace:MySpacePersonRequest x:Key="Owner" 
            RequestFields="opensocial.Person.Fields.DATE_OF_BIRTH"
            IdSpec="opensocial.IdSpec.PersonId.OWNER"/>
        <Synergist:DateTimeConverter x:Key="DateTimeConverter"/>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="SeaShell">
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="My birthday is "/>
            <TextBlock DataContext="{StaticResource Owner}"
                  Text="{Binding Person.DateOfBirth, Converter={StaticResource DateTimeConverter}, ConverterParameter=D}"/>
        </StackPanel>
    </Grid>
</UserControl>

Last edited Apr 1, 2009 at 4:40 AM by mscherotter, version 17

Comments

No comments yet.