Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# XAML加载并序列化到对象_C#_.net_Xaml - Fatal编程技术网

C# XAML加载并序列化到对象

C# XAML加载并序列化到对象,c#,.net,xaml,C#,.net,Xaml,我有一个奇怪的问题。 我想做的是通过加载带有 var test=(StructureFile)XamlServices.Load(reader); (控制台应用程序) 我实际上拥有的是StructureFile [RuntimeNameProperty("StructureFile")] [ContentProperty("Build")] public class StructureFile { public List<Item> Items

我有一个奇怪的问题。 我想做的是通过加载带有

var test=(StructureFile)XamlServices.Load(reader); (控制台应用程序)

我实际上拥有的是StructureFile

[RuntimeNameProperty("StructureFile")]
    [ContentProperty("Build")]
    public class StructureFile
    {
        public List<Item> Items { get; set; }

        public StructureFile()
        {
            Items = new List<Item>();
        }
    }
[RuntimeNameProperty(“StructureFile”)]
[内容属性(“构建”)]
公共类结构文件
{
公共列表项{get;set;}
公共结构文件()
{
项目=新列表();
}
}

公共类项目
{
公共字符串调用{get;set;}
公共列表项{get;set;}
}
xaml文件如下所示:

<StructureFile  xmlns="clr-namespace:SoSafeIP;assembly=blah" 
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:local="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib" 
                xmlns:my="clr-namespace:BindingXAML"
xmlns:Extentions="clr-Namespace:BuildFunctions.BuildExtenstions;assembly=BuildAddon">
  <StructureFile.Items>
    <scg:List x:TypeArguments="Item" Capacity="4">
      <Item Call="{Extentions:CreateChangeLog}" Items="{x:Null}" />

我在这里得到的是一个例外

'无法创建未知类型 “{clr命名空间:BuildFunctions.BuildExtenstions;assembly=BuildAddon}CreateChangeLog.” 行号“11”和行位置“13”

我甚至添加了BuildAddon dll作为参考(事实上,如果这能起作用,我想用IOC容器将其注入),但首先我需要先让它起作用

有什么想法吗

<StructureFile  xmlns="clr-namespace:SoSafeIP;assembly=blah" 
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:local="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib" 
                xmlns:my="clr-namespace:BindingXAML"
xmlns:Extentions="clr-Namespace:BuildFunctions.BuildExtenstions;assembly=BuildAddon">
  <StructureFile.Items>
    <scg:List x:TypeArguments="Item" Capacity="4">
      <Item Call="{Extentions:CreateChangeLog}" Items="{x:Null}" />