参考資料:Content プロパティ
プロパティは Object 型である為、格納できる項目に制限は無い。つまり文字でもUIElementでもなんでも入れて表示できる
<Window
       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
       xmlns:System="clr-namespace:System;assembly=mscorlib" x:Class="_IT_Tutorial2_2.MainWindow"
       xmlns:src="clr-namespace:_IT_Tutorial2_2"
       Title="MainWindow" Height="350" Width="525">

   <StackPanel>
       <Button>文字列のコンテンツ</Button>

       <Button Content="文字列のコンテンツ"/>
       
       <Button>
           <System:DateTime>2004/3/4 13:6:55</System:DateTime>
       </Button>
       
       <Button>
           <Rectangle Height="40" Width="40" Fill="Blue"/>
       </Button>

       <Button>
           <StackPanel>
               <Ellipse Height="40" Width="40" Fill="Blue"/>
               <TextBlock TextAlignment="Center">Button
               </TextBlock>
           </StackPanel>
       </Button>
       
       <Button Content="{DynamicResource res}">
           <Button.Resources>
               <StackPanel x:Key="res">
                   <Ellipse Fill="Black" Width="50" Height="50"/>
                   <Label Content="Test"/>
               </StackPanel>
           </Button.Resources>
       </Button>
       
   </StackPanel>
</Window>
最終更新:2012年10月10日 16:49