Microsoft.Silverlight.Testing.Controls.TreeViewItem.OnHasItemsPropertyChanged C# (CSharp) Метод

OnHasItemsPropertyChanged() приватный статический Метод

HasItemsProperty property changed handler.
private static OnHasItemsPropertyChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
d System.Windows.DependencyObject TreeViewItem that changed its HasItems.
e System.Windows.DependencyPropertyChangedEventArgs Event arguments.
Результат void
        private static void OnHasItemsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TreeViewItem source = d as TreeViewItem;

            // Ignore the change if requested
            if (source.IgnorePropertyChange)
            {
                source.IgnorePropertyChange = false;
                return;
            }

            // Ensure the property is only written when expected
            if (!source._allowWrite)
            {
                // Reset the old value before it was incorrectly written
                source.IgnorePropertyChange = true;
                source.SetValue(HasItemsProperty, e.OldValue);

                throw new InvalidOperationException();
            }

            source.UpdateVisualState(true);
        }