Esempio n. 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();
        }
Esempio n. 2
0
        /// <summary>
        /// ExpandDirectionProperty PropertyChangedCallback call back static function.
        /// This function validates the new value before calling virtual function OnExpandDirectionChanged.
        /// </summary>
        /// <param name="d">Expander object whose ExpandDirection property is changed.</param>
        /// <param name="e">DependencyPropertyChangedEventArgs which contains the old and new values.</param>
        private static void OnExpandDirectionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Expander        ctrl     = (Expander)d;
            ExpandDirection oldValue = (ExpandDirection)e.OldValue;
            ExpandDirection newValue = (ExpandDirection)e.NewValue;

            if (!IsValidExpandDirection(newValue))
            {
                ctrl.ExpandDirection = oldValue;

                string message = string.Format(
                    CultureInfo.InvariantCulture,
                    Properties.Resources.Expander_OnExpandDirectionPropertyChanged_InvalidValue,
                    newValue);
                throw new ArgumentException(message, "e");
            }

            ctrl.UpdateVisualState(true);
        }
        // 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();
        }