Пример #1
0
        public void UserControlNamescope1()
        {
            UserControl1Container ucc = new UserControl1Container();

            Assert.IsNotNull(ucc.FindName("userControl1"), "1");

            /* now with the reference to userControl1,
             * look up the name inside the UserControl1's
             * definition namescope (i.e. the one used to
             * parse it) */
            UserControl1 uc1 = (UserControl1)ucc.FindName("userControl1");

            Assert.IsNotNull(uc1.FindName("userControl1"), "2");


            /* now see if the two controls are sharing the
             * same namescope (i.e. it's been merged) by
             * checking to see if we can look up the
             * container's name in the embedded control's
             * namescope */

            Assert.IsNull(uc1.FindName("userControl1Container"), "3");

            /* and an element defined in the UserControl's
             * xaml is not locatable from outside that
             * scope */

            Assert.IsNull(ucc.FindName("border"), "4");
            Assert.IsNotNull(uc1.FindName("border"), "5");
        }
Пример #2
0
		public void UserControlNamescope1 ()
		{
			UserControl1Container ucc = new UserControl1Container();

			Assert.IsNotNull (ucc.FindName("userControl1"), "1");

			/* now with the reference to userControl1,
			   look up the name inside the UserControl1's
			   definition namescope (i.e. the one used to
			   parse it) */
			UserControl1 uc1 = (UserControl1)ucc.FindName("userControl1");

			Assert.IsNotNull (uc1.FindName ("userControl1"), "2");
			

			/* now see if the two controls are sharing the
			   same namescope (i.e. it's been merged) by
			   checking to see if we can look up the
			   container's name in the embedded control's
			   namescope */

			Assert.IsNull (uc1.FindName ("userControl1Container"), "3");

			/* and an element defined in the UserControl's
			   xaml is not locatable from outside that
			   scope */

			Assert.IsNull (ucc.FindName ("border"), "4");
			Assert.IsNotNull (uc1.FindName ("border"), "5");
		}