public void When_DependencyObjectCollection_And_XBind() { var SUT = new Border(); var root = new { MyElement = new Border() { Tag = true } }; var group = new VisualStateGroup(); var state = new VisualState(); var compositeTrigger = new CompositeTrigger(); var stateTrigger = new StateTrigger(); stateTrigger.SetBinding( StateTrigger.IsActiveProperty, new Binding { Path = "MyElement.Tag", CompiledSource = root } ); Assert.AreEqual(false, stateTrigger.IsActive); var triggers = new DependencyObjectCollection(); triggers.Add(stateTrigger); compositeTrigger.TriggerCollection = triggers; state.StateTriggers.Add(compositeTrigger); group.States.Add(state); VisualStateManager.SetVisualStateGroups(SUT, new List <VisualStateGroup>() { group }); SUT.ForceLoaded(); SUT.ApplyCompiledBindings(); Assert.AreEqual(true, stateTrigger.IsActive); compositeTrigger.TriggerCollection = null; Assert.IsNull(triggers.GetParent()); }