示例#1
0
		public void SetUnsetClear_Tag ()
		{
			var obj = new object ();
			ConcreteFrameworkElement fe = new ConcreteFrameworkElement () {
					Tag = obj
				};
			fe.SetValue(FrameworkElement.TagProperty, DependencyProperty.UnsetValue);			
			Assert.IsNull (fe.Tag, "Tag is not null (the default value)");
			fe.Tag = 3;
			Assert.AreEqual (3, fe.Tag, "Tag can change though");
			fe.SetValue(FrameworkElement.TagProperty, DependencyProperty.UnsetValue);			
			Assert.IsNull (fe.Tag, "Tag is null");
		}
示例#2
0
		public void InvalidValues()
		{
			ConcreteFrameworkElement f = new ConcreteFrameworkElement ();
			Assert.Throws<Exception>(delegate {
				f.Language = null;
			}, "#1"); // Fails in Silverlight 3 (got System.Exception)
			Assert.Throws<Exception>(delegate {
				f.SetValue (FrameworkElement.LanguageProperty, null);
			}, "#2");
		}
示例#3
0
		public void SetUnset ()
		{
			var obj = new object ();
			ConcreteFrameworkElement fe = new ConcreteFrameworkElement () {
					Width = 30,
					Foo = obj,
					DefaultFoo = obj
				};
		        fe.SetValue(FrameworkElement.WidthProperty, DependencyProperty.UnsetValue);
			fe.SetValue(ConcreteFrameworkElement.FooProperty, DependencyProperty.UnsetValue);
			fe.SetValue(ConcreteFrameworkElement.DefaultFooProperty, DependencyProperty.UnsetValue);
			Assert.IsTrue (double.IsNaN (fe.Width), "Width is NaN (the default value)");
			Assert.AreEqual (3, fe.DefaultFoo, "DefaultFoo is 3 (the default value)");
			Assert.IsNull (fe.Foo, "Foo is null");
		}