C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Stroke: Next, try adding the Stroke attribute in the XAML. You will need to manually specify this in the markup.
StrokeThickness: You can adjust the thickness of the Stroke (border) by adding a StrokeThickness attribute, which counts in pixels.
Example markup: XAML
<Window x:Class="WpfApplication16.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Rectangle Fill="Beige" HorizontalAlignment="Left"
Height="100" Margin="10,10,0,0"
Stroke="DarkMagenta" StrokeThickness="5"
VerticalAlignment="Top" Width="150"
RadiusY="13.5" RadiusX="13.5"/>
</Grid>
</Window>
Tip: In the Ellipse example, I show how mouse events can interact with shapes. This is equally true with rectangles.