internal static void MeasureView(WorkflowViewElement view, bool measureAsCollapsed) { bool expandState = view.ExpandState; bool pinState = view.PinState; if (measureAsCollapsed) { view.ForceCollapse(); } view.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); view.UpdateLayout(); if (view.ExpandState != expandState) { view.ExpandState = expandState; } if (view.PinState != pinState) { view.PinState = pinState; } }