DataTemplate for Int32

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:Int32}">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Integer: " />
                <TextBlock Text="{Binding}" />
            </StackPanel>
        </DataTemplate>

    </Page.Resources>

    <StackPanel>
        <Button>
            <s:Int32>1</s:Int32>
        </Button>

    </StackPanel>
</Page>