private void ChangeVisualState(bool useTransitions) { if (!IsPaneOpen) { if (DisplayMode == SplitViewDisplayMode.CompactInline) { GoToState(useTransitions, "ClosedCompact" + PanePlacement.ToString()); } else { GoToState(useTransitions, "Closed"); } } else { switch (DisplayMode) { case SplitViewDisplayMode.Overlay: GoToState(useTransitions, "OpenOverlay" + PanePlacement.ToString()); break; case SplitViewDisplayMode.Inline: GoToState(useTransitions, "OpenInline" + PanePlacement.ToString()); break; case SplitViewDisplayMode.CompactOverlay: GoToState(useTransitions, "OpenCompactOverlay" + PanePlacement.ToString()); break; } } }
private static void OnPanePlacementChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var sv = d as SplitView02; if (sv != null) { PanePlacement oldPlacement = (PanePlacement)e.OldValue; PanePlacement newPlacement = (PanePlacement)e.NewValue; if (oldPlacement != newPlacement) { sv.TemplateSettings.UpdateForPlacementChanged(); sv.OnPlacementChanged(oldPlacement, newPlacement); } } }
internal void UpdateForPlacementChanged() { PanePlacement newPlacement = this.Owner.PanePlacement; if (newPlacement == PanePlacement.Left) { TranslateOverlayFrom = this.NegativePaneLength; NegativeTranslateOverlayFrom = this.OpenPaneLength; TranslateCompactToOpenLength = this.CompactToOpenLength; AdaptOpenThickness = new Thickness(0, 0, this.OpenPaneLength, 0); AdaptCompactToOpenMargin = new Thickness(0, 0, this.CompactToOpenLength, 0); } else { TranslateOverlayFrom = this.OpenPaneLength; NegativeTranslateOverlayFrom = this.NegativePaneLength; TranslateCompactToOpenLength = -this.CompactToOpenLength; AdaptOpenThickness = new Thickness(this.OpenPaneLength, 0, 0, 0); AdaptCompactToOpenMargin = new Thickness(this.CompactToOpenLength, 0, 0, 0); } }
protected virtual void OnStateChanged(bool animated = true) { if (PaneClipRectangle != null) { PaneClipRectangle.Rect = new Rect(0, 0, OpenPaneLength, ActualHeight); } var state = string.Empty; if (IsPaneOpen) { state += "Open"; switch (DisplayMode) { case SplitViewDisplayMode.CompactInline: state += "Inline"; break; default: state += DisplayMode.ToString(); break; } state += PanePlacement.ToString(); } else { state += "Closed"; if (DisplayMode == SplitViewDisplayMode.CompactInline || DisplayMode == SplitViewDisplayMode.CompactOverlay) { state += "Compact"; state += PanePlacement.ToString(); } } VisualStateManager.GoToState(this, state, animated); }
protected virtual string GetVisualState() { string state = string.Empty; if (IsPaneOpen) { state = "Open"; state += IsInline ? "Inline" : DisplayMode.ToString(); } else { state = "Closed"; if (IsCompact) { state += "Compact"; } else { return(state); } } state += PanePlacement.ToString(); return(state); }
private void OnPanePlacementChanged(PanePlacement oldPlacement, PanePlacement newPlacement) { TemplateSettings.UpdateForPlacementChanged(); VisualStateManager.GoToState(this, SplitViewState.NoneState, true); SwitchToState(curToCloseState); }
protected virtual void OnPlacementChanged(PanePlacement oldPlacement, PanePlacement newPlacement) { VisualStateManager.GoToState(this, SplitViewState.NoneState, true); SwitchToState(ToCloseStateName); }