ソースコード
App.xaml
<Application x:Class="HelloWorld.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="MainWindow.xaml"> </Application>
MainWindow.xaml
<Window x:Class="HelloWorld.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" Title="Button"> <Button> <Button.Template> <ControlTemplate TargetType="{x:Type Button}"> <Ellipse Width="100" Height="80" Fill="Blue"></Ellipse> </ControlTemplate> </Button.Template> </Button> </Window>
参考
Control.Template プロパティ (System.Windows.Controls)
コントロール テンプレートを取得または設定します。 ...
ControlTemplate クラス (System.Windows.Controls)
コントロールの複数のインスタンスで共有できる、Control のビジュアル構造と動作特性を指定します。 ...