I'm working on an application that has two different tabs on the main window. Each tab has it's own canvas as a child object. When the tab selection is changed I redraw the canvas on that tab.

The problem is, when a user switches to the second tab for the first tab, the "tab changed" event fires before the canvas on the second tab has been assigned a size (debugging shows it has a size of 0,0). As such, the custom elements I add to it don't draw correctly since they are size dependent. If it redraws after the tab has been opened already it works fine since the size has been set by that point.

Can someone please suggest a way to have the size set before the tab is first selected or is there some other trick I can use?