Exemplo n.º 1
0
        public void additional_namespaces_can_be_specified()
        {
            var writer = new XamlWriter(_sw, new XamlWriterSettings(cfg => cfg.AddReference("foo", "Acme.SuperNameSpace", "Acme.SuperAssembly")));

            writer.Dispose();
            GeneratedOutput.Should().Contain(@"xmlns:foo=""clr-namespace:Acme.SuperNameSpace;assembly=Acme.SuperAssembly""");
        }
Exemplo n.º 2
0
        public void root_control_can_be_overridden()
        {
            var writer = new XamlWriter(_sw, new XamlWriterSettings(cfg => cfg.SetRootElement("StackPanel")));

            writer.Dispose();
            GeneratedOutput.Should().StartWith("<StackPanel");
        }
Exemplo n.º 3
0
        public void root_control_can_be_custom_control()
        {
            var writer = new XamlWriter(_sw, new XamlWriterSettings(cfg => cfg.AddReference("foo", "FooNameSpace").SetRootElement("foo:FooPanel")));

            writer.Dispose();
            GeneratedOutput.Should().StartWith("<foo:FooPanel");
        }
Exemplo n.º 4
0
        public void default_generates_empty_content_control()
        {
            var writer = new XamlWriter(_sw);

            writer.Dispose();
            GeneratedOutput.Should().StartWith("<ContentControl");
        }
Exemplo n.º 5
0
        public void add_nested_element()
        {
            var writer = new XamlWriter(_sw);

            writer.RegisterReference("query", "abc");
            writer.StartElement("query:Viewer", w => w.AddAttribute("Value", "{Binding}"));
            writer.Dispose();
            GeneratedOutput.Should().Contain("  <query:Viewer");
        }