New to WPF, how would I create these colored bars in my form? New to WPF, how would I create these colored bars in my form? wpf wpf

New to WPF, how would I create these colored bars in my form?


Yes, your approach is just fine. Set the background color with the Fill property:

            <Rectangle Grid.Column="0" Fill="Orange" />            <Rectangle Grid.Column="2" Fill="Orange" />


<Rectangle Grid.Column="0"            VerticalAlignment="Stretch"            HorizontalAlignment="Stretch"            Fill="Orange" />


Set the background of the window to your orange color. Then set the background of the grid to white, set the width of the grid so that it leaves space on either side, and set the grids HorizontalAlignment to center.

<Windows ....    Background="Orange>  <Grid Background="White" HorizontalAlignment="Center" Width="300">  ...  </Grid></Window>