There is a TabControl with two tabs, and on each, say, a Grid . TabControl stretched over the main window. When starting the program, the first tab is active. Until you activate the second tab, the ActualWidth and ActualHeight grid on the second tab remain zero.

What methods need to be called and from whom to find out the current size of the item (s) on a hidden tab?

  • The concept of drawing elements in WPF is such that they themselves draw at the time of transferring to them the dimensions from outside that they can take. Most likely, TabPanel calls the Measure and Arrange methods only at the time of the transition by passing dimensions, so the element has no idea about its size until the transition to the tab. You can of course pass the dimensions from TabControl itself to Measure and Arrange , but I have no idea how WPF will behave in this case and how the logic of drawing the element itself is implemented inside and what dimensions exactly are transmitted. - Alex Krass
  • Well, that is, you can manually call Measure on the element, and poll DesiredSize . But this is a very low-level approach. Why do you need it? - VladD

0