I am trying to create a generic dialog which is paged using a TabControl. The dialog has SizeToContent="true" so that the dialog has no unused white-space. The TabControl uses the ItemsSource to set the page content from the model and a ContentTemplateSelector to select the page layout.
The problem I am having is the SizeToContent effect is causing the dialog to resize every time the TabControl.SelectedItem changes where I would rather the dialog sized itself using the content from the largest TabItem.
I've tried using SharedSizeGroup option but this doesn't work. I think this is because a TabControl with an ItemsSource and a ContentTemplateSelector will load the selected tab only and discards the rest, so there is only ever one element of the SharedSizeGroup that is instantiated at one time.
This article offers another solution where each TabItem is measured but this solution doesn't work for me because I am using an ItemsSource and reading the Items collection returns my model objects and not TabItems.
If anyone can offer a solution to this I would be very grateful.