フォームで何度も使用できるボタンのテンプレートを作成しようとしています。
、2行のaと、一番下の行内のカスタムテキストButton
を含める必要があります。Grid
これは私がこれまでに得たものですが、ボタン要素内からテキストを設定したいので、正しくないと思います。
<ControlTemplate TargetType="Control">
<Grid Width="444">
<Grid.RowDefinitions>
<RowDefinition Height="51" />
<RowDefinition Height="36" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" Background="#286c97"></Grid>
<Grid Grid.Row="1" Background="#5898c0">
<TextBlock Grid.Row="1" FontFamily="Segoe UI" FontSize="12" Text="{TemplateBinding Content}" />
</Grid>
</Grid>
</ControlTemplate>
次に、私が行けることを望んでいたテンプレートを呼び出すために:
<Button Content="This is the text" />
しかし悲しいことに、これは機能しません。テキスト値を渡すために使用することになっている他のテンプレートはありますか?