//Calculates whether ShowExpanded for a given WorklfowViewElement should be true or false. public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { ModelItem modelItem = (ModelItem)values[0]; bool isRootDesigner = (bool)values[1]; bool shouldExpandAll = (bool)values[2]; bool shouldCollapseAll = (bool)values[3]; bool expandState = (bool)values[4]; bool pinState = (bool)values[5]; WorkflowViewElement viewElement = (WorkflowViewElement)values[6]; //Pinstate should be false in following cases (Designer should be unpinned in following cases): //1. ExpandAll is not enabled. //2. ExpandAll is enabled and ExpandState is true. //Similarly for Collapse All. if ((!shouldExpandAll || expandState) && (!shouldCollapseAll || !expandState)) { viewElement.PinState = false; } if (viewElement.IsAncestorOfRootDesigner) { return(true); } return(ViewUtilities.ShouldShowExpanded(isRootDesigner, viewElement.DoesParentAlwaysExpandChild(), viewElement.DoesParentAlwaysCollapseChildren(), expandState, shouldExpandAll, shouldCollapseAll, viewElement.PinState)); }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if (values[0] != DependencyProperty.UnsetValue && values[1] != DependencyProperty.UnsetValue) { bool isExpanded = (bool)values[0]; bool isPinned = (bool)values[1]; bool shouldExpandAll = (bool)values[2]; bool shouldCollapseAll = (bool)values[3]; ExpandableItemWrapper wrapper = (ExpandableItemWrapper)values[4]; if ((!shouldExpandAll || isExpanded) && (!shouldCollapseAll || !isExpanded)) { wrapper.SetPinState(false); } return(ViewUtilities.ShouldShowExpanded(isExpanded, shouldExpandAll, shouldCollapseAll, wrapper.IsPinned)); } else { return(false); } }