Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

  • Jim Mangaly

    Jim Mangaly

    Contributor

    2646 Points

    383 Posts

    Re: Formating Data grid date column

    Apr 23, 2008 12:16 PM | LINK

    Check out this link in MSDN:  http://msdn2.microsoft.com/en-us/library/cc189753(VS.95).aspx

    Notice the following portion in the article where it defines a DataTemplateColumn. You can see that data binding is used to display text in the text block. Binding gives you an option to add a converter to modify the source to a format you want. See this article on converters:  http://msdn2.microsoft.com/en-us/library/cc278072(vs.95).aspx

    <data:DataGridTemplateColumn Header="Name">

                        <data:DataGridTemplateColumn.CellTemplate>

                            <DataTemplate>

                                <StackPanel Orientation="Horizontal">

                                    <TextBlock Padding="5,0,5,0"

                                        Text="{Binding FirstName}"/>

                                    <TextBlock Text="{Binding LastName}"/>

                                </StackPanel>

                            </DataTemplate>

                        </data:DataGridTemplateColumn.CellTemplate

                    </data:DataGridTemplateColumn>         

     

    Jim (http://jimmangaly.blogspot.com/)

    http://www.identitymine.com/