public void StaticResources() { UserControl3Container ucc = new UserControl3Container(); /* make sure the brush is in the resources */ Assert.IsNotNull(ucc.Resources["backgroundBrush"], "1"); /* it should also be available through FindName */ Assert.IsNotNull(ucc.FindName("backgroundBrush"), "2"); /* make sure the second brush (registered with x:Key) is in the resources */ Assert.IsNotNull(ucc.Resources["backgroundBrush2"], "3"); /* but it is not available through FindName */ Assert.IsNull(ucc.FindName("backgroundBrush2"), "4"); UserControl3 uc3 = (UserControl3)ucc.FindName("userControl3"); // the brush's name is not available through the control's namescope. Assert.IsNull(uc3.FindName("backgroundBrush"), "5"); }
public void StaticResources () { UserControl3Container ucc = new UserControl3Container (); /* make sure the brush is in the resources */ Assert.IsNotNull (ucc.Resources["backgroundBrush"], "1"); /* it should also be available through FindName */ Assert.IsNotNull (ucc.FindName ("backgroundBrush"), "2"); /* make sure the second brush (registered with x:Key) is in the resources */ Assert.IsNotNull (ucc.Resources["backgroundBrush2"], "3"); /* but it is not available through FindName */ Assert.IsNull (ucc.FindName ("backgroundBrush2"), "4"); UserControl3 uc3 = (UserControl3)ucc.FindName ("userControl3"); // the brush's name is not available through the control's namescope. Assert.IsNull (uc3.FindName ("backgroundBrush"), "5"); }