Step 1 : MainWindow.xaml.cs Code


<Window x:Class="Drawline.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 Height="100" HorizontalAlignment="Left" Margin="148,102,0,0"
         Name="Rectangle" Stroke="Black" Fill="Yellow" StrokeThickness="4"
         VerticalAlignment="Top" Width="200"/>  
    </Grid>
</Window>

Output :


wpf21