vb.net Code:
Private Sub Window1_Loaded(ByVal sender As Object, _
ByVal e As RoutedEventArgs) Handles MyBase.Loaded
Dim testRect As New Rectangle
Dim testCanvas As New Canvas
Dim testGrid As New Grid
testGrid.Children.Add(testCanvas)
testCanvas.Children.Add(testRect)
testRect.RadiusX = 3
testRect.RadiusY = 3
DirectCast(Me.Content, Grid).Children.Add(testGrid)
End Sub
and saw nothing. I then changed it to this:
vb.net Code:
Private Sub Window1_Loaded(ByVal sender As Object, _
ByVal e As RoutedEventArgs) Handles MyBase.Loaded
Dim testRect As New Rectangle
Dim testCanvas As New Canvas
Dim testGrid As New Grid
testGrid.Children.Add(testCanvas)
testCanvas.Children.Add(testRect)
testRect.RadiusX = 3
testRect.RadiusY = 3
testRect.Stroke = Brushes.Black
testRect.Height = 100
testRect.Width = 200
DirectCast(Me.Content, Grid).Children.Add(testGrid)
End Sub
and lo and behold, a rectangle appeared. If your rectangle has no height and no width, its border has no colour and it's not added to the Window's content, I guess it would be hard to see. :)