/// <summary> /// Initializes a new instance of the GridExpander class, /// which inherits from System.Windows.Controls.GridExpander. /// </summary> public GridExpander() { // Set default values //DefaultStyleKey = typeof(GridExpander); VisualStateManager.GoToState(this, "Checked", false); //Direction = GridExpanderDirection.None; IsAnimated = true; this.LayoutUpdated += delegate { _gridCollapseDirection = GetCollapseDirection(); }; // All GridExpander visual states are handled by the parent GridSplitter class. }
/// <summary> /// This method is called when the tempalte should be applied to the control. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); _expanderButton = GetTemplateChild(ElementHandleName) as ToggleButton; _elementGridExpanderBackground = GetTemplateChild(ElementGridExpanderBackground) as Rectangle; // Wire up the Checked and Unchecked events of the VerticalGridExpanderHandle. if (_expanderButton != null) { _expanderButton.Checked += new RoutedEventHandler(GridSplitterButton_Checked); _expanderButton.Unchecked += new RoutedEventHandler(GridSplitterButton_Unchecked); } // Set default direction since we don't have all the components layed out yet. _gridCollapseDirection = GridCollapseOrientation.Auto; // Directely call these events so design-time view updates appropriately OnDirectionChanged(Direction); OnIsCollapsedChanged(IsCollapsed); }
/// <summary> /// This method is called when the tempalte should be applied to the control. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); _expanderButton = GetTemplateChild(ElementHandleName) as ToggleButton; _elementGridExpanderBackground = GetTemplateChild(ElementGridExpanderBackground) as Rectangle; // Wire up the Checked and Unchecked events of the VerticalGridExpanderHandle. if (_expanderButton != null) { _expanderButton.Checked += new RoutedEventHandler(GridExpanderButton_Checked); _expanderButton.Unchecked += new RoutedEventHandler(GridExpanderButton_Unchecked); } // Set default direction since we don't have all the components layed out yet. _gridCollapseDirection = GridCollapseOrientation.Auto; // Directely call these events so design-time view updates appropriately OnDirectionChanged(Direction); OnIsCollapsedChanged(IsCollapsed); }