/// <summary> /// The DirectionProperty property changed handler. /// </summary> /// <param name="d">GridExpander that changed IsCollapsed.</param> /// <param name="e">An instance of DependencyPropertyChangedEventArgs.</param> private static void OnDirectionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { GridExpander s = d as GridExpander; GridExpanderDirection value = (GridExpanderDirection)e.NewValue; s.OnDirectionChanged(value); }
/// <summary> /// Handles the property change event of the Direction property. /// </summary> /// <param name="direction">The new value for the Direction property.</param> protected virtual void OnDirectionChanged(GridExpanderDirection direction) { if (_expanderButton == null) { // There is no expander button so don't attempt to modify it return; } // TODO: Use triggers for setting visibility conditionally instead of doing it here if (direction == GridExpanderDirection.None) { // Hide the handles if the Direction is set to None. _expanderButton.Visibility = Visibility.Collapsed; } else { // Ensure the handle is Visible. _expanderButton.Visibility = Visibility.Visible; } }