protected override Size MeasureOverride(Size constraint)
{
if (_hwndSource != null && _hwndSource.RootVisual != null) {
HwndSourceHostRoot root = (HwndSourceHostRoot)_hwndSource.RootVisual;
// We are a simple pass-through element.
root.Measure(constraint);
return root.DesiredSize;
} else {
// We don't have a child yet.
return new Size();
}
}