1
以下の両方の構文が機能します。私の質問は、WPFはコンテンツが私が指定したものであることをどのように知っていますか?同様Contentプロパティはどのように機能するのですか
<Button>
<Button.Content>
my button
</Button.Content>
</Button>
<Button>
my button <!--how does wpf know this is the content-->
</Button>
、どのように私は今ListBoxItems
<ListBox>
<!--ListBox.Items-->
<ListBoxItem Content="item 1" /> <!--XAML automatically knows I'm specifying items-->
item 2
<ListBoxItem Content="item 3" />
<!--/ListBox.Items-->
</ListBox>
のでContentControlにして、デフォルトのプロパティがコンテンツである、とのItemsControlで、デフォルトは、アイテムである、とのTextBoxと
を追加しているWPF知っていますデフォルトはTextBoxです。この「デフォルト」はどのように機能しますか?
カスタムコントロールを作成するときに、この「デフォルトプロパティ」を作成するにはどうすればよいですか?