1
votes

So i have this piece of programmatically created content that is dependent on the actualWidth/actualHeight values of its parent canvas. When the said content is created during the Loaded event of the parent window though, the width and height of the canvas still appear to be 0. This is corrected as soon as I resize the window via the sizeChanged event but still, I want the stuff to look its best right away.

Is there another event to guarantee the window being ready to use?

heres the loaded event handler

Public Sub onLoad() Handles Me.Loaded
     Dim wc As New uiFloaterCanvas <- the item that needs to have correct actualWidth/height values
     mainGrid.Children.add(wc) <- grid attatched to the main window in designer
     ww = wc.createFloater() <- spawns a usercontrol inside the canvas
     ww.place(New DoubleRect(300, 300, 500, 500)) <- fails to do its job because the place sub clips the width/height to actualwidth/height of the canvas
End Sub
1

1 Answers

0
votes

Well I figured it out. If I want things to be ready by the Loaded event, I must add them to the layout in Initialized event.