public void SelectionBoxItem_Rectangle_Is_Removed_From_Logical_Tree() { var target = new DropDown { Items = new[] { new Canvas() }, SelectedIndex = 0, Template = GetTemplate(), }; var root = new TestRoot { Child = target }; target.ApplyTemplate(); target.Presenter.ApplyTemplate(); var rectangle = target.GetValue(DropDown.SelectionBoxItemProperty) as Rectangle; Assert.True(((ILogical)target).IsAttachedToLogicalTree); Assert.True(((ILogical)rectangle).IsAttachedToLogicalTree); rectangle.DetachedFromLogicalTree += (s, e) => { }; root.Child = null; Assert.False(((ILogical)target).IsAttachedToLogicalTree); Assert.False(((ILogical)rectangle).IsAttachedToLogicalTree); }
public void Logical_Children_Should_Be_Children_Of_Container() { var target = new DropDown(); target.Template = GetTemplate(); target.ApplyTemplate(); var childIds = ((ILogical)target).LogicalChildren.Cast <Control>().Select(x => x.Name); Assert.Equal(new[] { "contentControl", "toggle", "popup" }, childIds); }
public void Logical_Children_Should_Be_Children_Of_Container() { var target = new DropDown(); target.Template = GetTemplate(); target.ApplyTemplate(); var childIds = ((ILogical)target).LogicalChildren.Cast<Control>().Select(x => x.Name); Assert.Equal(new[] { "contentControl", "toggle", "popup" }, childIds); }