DateTemplate for Date Time, filter value by path

image_pdfimage_print


   
  
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:s="clr-namespace:System;assembly=mscorlib">
    <Page.Resources>

        <DataTemplate DataType="{x:Type s:DateTime}">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="DateTime: " />
                <TextBlock Text="{Binding Path=Month}" />
                <TextBlock Text="/" />
                <TextBlock Text="{Binding Path=Day}" />
                <TextBlock Text="/" />
                <TextBlock Text="{Binding Path=Year}" />
            </StackPanel>
        </DataTemplate>

    </Page.Resources>

    <StackPanel>
        <Button>
            <x:Static Member="s:DateTime.Now" />
        </Button>

    </StackPanel>
</Page>