protected override System.Windows.Size MeasureOverride(System.Windows.Size constraint) { var uiSize = new System.Windows.Size(); if (TargetElement != null) { TargetElement.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => TargetElement.Measure(constraint))); uiSize = TargetElement.DesiredSize; } return(uiSize); }