Customizing the template of a control
Another feature that makes XAML so powerful is the ability to customize the template of every control. Thanks to this feature, you can completely change the look, feel, or behavior of a control without creating a new one, as you would need to do in Windows Forms.
The template of a control is stored in a property called Template
, which you can redefine to change it. Let's see, for example, how we can customize the template of a Button
control:
<Button Content="Ok" Background="Red" Width="150" Height="50"> <Button.Template> <ControlTemplate TargetType="Button"> <Grid> <Ellipse Height="{TemplateBinding Height...