示例#1
0
		public void LoadTemplateOnlyUsingXamlReader ()
		{
			UserControl c = new UserControl ();

			ControlTemplate t = (ControlTemplate)XamlReader.Load (@"
<ControlTemplate TargetType=""UserControl"" xmlns=""http://schemas.microsoft.com/client/2007"">
  <TextBlock Text=""hi"" />
</ControlTemplate>");

			Assert.Throws<InvalidOperationException> (delegate {
				c.Template = t;
			});
			
			Assert.IsFalse (c.ApplyTemplate (), "0");
		}