public void XmlSpacePreserve2() { StackPanel s1 = new XmlSpace3(); if (!XmlAttributeProperties.GetXmlSpace((DependencyObject)s1).Equals("preserve")) { throw new Exception("Expected outer StackPanel's xml:space to be 'preserve'."); } StackPanel s2 = s1.Children[0] as StackPanel; if (!XmlAttributeProperties.GetXmlSpace((DependencyObject)s2).Equals("preserve")) { throw new Exception("Expected inner StackPanel's xml:space to be 'preserve'."); } }
public void XmlSpaceDefault() { StackPanel s1 = new XmlSpace1(); if (!XmlAttributeProperties.GetXmlSpace((DependencyObject)s1).Equals("default")) { throw new Exception("Expected the outer StackPanel's xml:space to be 'default'."); } StackPanel s2 = s1.Children[0] as StackPanel; if (!XmlAttributeProperties.GetXmlSpace((DependencyObject)s2).Equals("default")) { throw new Exception("Expected the inner StackPanel's xml:space to be 'default'."); } }
public void XmlSpacePreserve2() { string x = @"<StackPanel xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' xml:space='preserve'> <StackPanel xml:space='preserve'/> </StackPanel>"; var o = System.Windows.Markup.XamlReader.Load(new XmlTextReader(new StringReader(x))); StackPanel s1 = o as StackPanel; if (!XmlAttributeProperties.GetXmlSpace((DependencyObject)s1).Equals("preserve")) { throw new Exception(string.Format("Expected outer StackPanel's xml:space to be 'preserve' in:\n\n{0}", x)); } StackPanel s2 = s1.Children[0] as StackPanel; if (!XmlAttributeProperties.GetXmlSpace((DependencyObject)s2).Equals("preserve")) { throw new Exception(string.Format("Expected inner StackPanel's xml:space to be 'preserve' in:\n\n{0}", x)); } }