public void MentorTest_FrameworkElement_CollectionInCustomProperty_AttachOppositeOrder() { var mentor = new MentorElement(); var collection = new DependencyObjectCollection<object>(); var child = new SolidColorBrush(); BindingOperations.SetBinding(child, SolidColorBrush.ColorProperty, new Binding()); // Attach the child then the collection collection.Add(child); mentor.MentoredCollection = collection; mentor.DataContext = Colors.Red; Assert.AreEqual(Colors.Red, child.Color, "#1"); }
/// <summary> /// Initializes a new instance of the <see cref="ToolSetGroup"/> class. /// </summary> public ToolSetGroup() { DefaultStyleKey = typeof( ToolSetGroup ); Items = new DependencyObjectCollection<ToolSetButton> (); }
/// <summary> /// Constructs a new AuthorizationRule. /// </summary> public AuthorizationRule() { Parts = new DependencyObjectCollection<IAuthorizationRulePart>(); }
/// <summary> /// Provides derived classes an opportunity to handle changes to /// the MenuItems property. /// </summary> /// <param name="oldMenuItems">The old menu items.</param> /// <param name="newMenuItems">The new menu items.</param> protected virtual void OnMenuItemsChanged( DependencyObjectCollection<BindableApplicationBarMenuItem> oldMenuItems, DependencyObjectCollection<BindableApplicationBarMenuItem> newMenuItems) { if (oldMenuItems != null) { oldMenuItems.CollectionChanged -= this.MenuItemsCollectionChanged; } if (newMenuItems != null) { newMenuItems.CollectionChanged += this.MenuItemsCollectionChanged; } }
/// <summary> /// Provides derived classes an opportunity to handle changes to /// the Buttons property. /// </summary> /// <param name="oldButtons">The old buttons.</param> /// <param name="newButtons">The new buttons.</param> protected virtual void OnButtonsChanged( DependencyObjectCollection<BindableApplicationBarButton> oldButtons, DependencyObjectCollection<BindableApplicationBarButton> newButtons) { if (oldButtons != null) { oldButtons.CollectionChanged -= this.ButtonsCollectionChanged; } if (newButtons != null) { newButtons.CollectionChanged += this.ButtonsCollectionChanged; } }
/// <summary> /// Constructs an ErrorPageLoader. /// </summary> public ErrorPageLoader() { ErrorPages = new DependencyObjectCollection<IErrorPage>(); }
public DependencyObjectCollectionEvents(DependencyObjectCollection This) { this.This = This; }