To add a button control and a text block to the canvas : Button « Windows Presentation Foundation « C# / C Sharp
- C# / C Sharp
- Windows Presentation Foundation
- Button
To add a button control and a text block to the canvas
<Window x:Class="LineInCustomSystem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Line In Custom System" Height="240" Width="220">
<Border BorderBrush="Black" BorderThickness="1" Height="200"
Width="200">
<Canvas Height="200" Width="200">
<Button Canvas.Top="50" Canvas.Left="80" FontSize="15" Foreground="Red"
Name="label1" Content="My Button" />
<TextBlock Canvas.Top="120" Canvas.Left="20" FontSize="12pt"
Foreground="Blue">
<Bold>My Text Block</Bold>
</TextBlock>
</Canvas>
</Border>
</Window>
Related examples in the same category