Beispiel #1
0
        private static void OnIsExpandedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Expander ep = (Expander)d;

            bool newValue = (bool)e.NewValue;

            // Fire accessibility event
            ExpanderAutomationPeer peer = UIElementAutomationPeer.FromElement(ep) as ExpanderAutomationPeer;

            if (peer != null)
            {
                peer.RaiseExpandCollapseAutomationEvent(!newValue, newValue);
            }

            if (newValue)
            {
                ep.OnExpanded();
            }
            else
            {
                ep.OnCollapsed();
            }

            ep.UpdateVisualState();
        }
        // Token: 0x06004B06 RID: 19206 RVA: 0x001524E0 File Offset: 0x001506E0
        private static void OnIsExpandedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Expander expander = (Expander)d;
            bool     flag     = (bool)e.NewValue;
            ExpanderAutomationPeer expanderAutomationPeer = UIElementAutomationPeer.FromElement(expander) as ExpanderAutomationPeer;

            if (expanderAutomationPeer != null)
            {
                expanderAutomationPeer.RaiseExpandCollapseAutomationEvent(!flag, flag);
            }
            if (flag)
            {
                expander.OnExpanded();
            }
            else
            {
                expander.OnCollapsed();
            }
            expander.UpdateVisualState();
        }
        /// <summary>
        /// ExpandedProperty PropertyChangedCallback static function.
        /// </summary>
        /// <param name="d">Expander object whose Expanded property is changed.</param>
        /// <param name="e">DependencyPropertyChangedEventArgs which contains the old and new values.</param>
        private static void OnIsExpandedPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Expander ctrl       = (Expander)d;
            bool     isExpanded = (bool)e.NewValue;

            // Notify any automation peers of the expansion change
            ExpanderAutomationPeer peer = FrameworkElementAutomationPeer.FromElement(ctrl) as ExpanderAutomationPeer;

            if (peer != null)
            {
                peer.RaiseExpandCollapseAutomationEvent((bool)e.OldValue, isExpanded);
            }

            if (isExpanded)
            {
                ctrl.OnExpanded();
            }
            else
            {
                ctrl.OnCollapsed();
            }
        }