public virtual void ShouldBeAbleToClearValue() { TimePicker tip = new TimePicker(); bool executed = false; bool loaded = false; tip.Loaded += (sender, args) => loaded = true; tip.LayoutUpdated += (sender, args) => { if (executed) { return; } executed = true; tip.Value = new DateTime(); tip.ClearValue(TimePicker.ValueProperty); Assert.IsTrue(DependencyProperty.UnsetValue == tip.ReadLocalValue(TimePicker.ValueProperty)); }; EnqueueCallback(() => TestPanel.Children.Add(tip)); EnqueueConditional(() => loaded); EnqueueCallback(() => executed = false); EnqueueCallback(tip.UpdateLayout); EnqueueConditional(() => executed); EnqueueTestComplete(); }