Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/297.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.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# XML传递给我,以绑定到C中的网格#_C#_Xml_Wpf_Datagrid - Fatal编程技术网

C# XML传递给我,以绑定到C中的网格#

C# XML传递给我,以绑定到C中的网格#,c#,xml,wpf,datagrid,C#,Xml,Wpf,Datagrid,我有一个程序,可以调用另一个程序。这个程序返回一些XML。有没有办法将这个XML从内存绑定到datagrid或grid?我找到的示例都显示了如何从文件绑定xml,但我的文件不在磁盘上,而是在内存中,由另一个程序调用。我的语法是什么?我只有一个变量,XML是一个blob。我怎样才能把它放到数据网格中 if (Customer.ToString() != null) { var XmlIn = InvoiceQueryXml(Customer.ToString()); var Xml

我有一个程序,可以调用另一个程序。这个程序返回一些XML。有没有办法将这个XML从内存绑定到datagrid或grid?我找到的示例都显示了如何从文件绑定xml,但我的文件不在磁盘上,而是在内存中,由另一个程序调用。我的语法是什么?我只有一个变量,XML是一个blob。我怎样才能把它放到数据网格中

if (Customer.ToString() != null)
{
    var XmlIn = InvoiceQueryXml(Customer.ToString());
    var XmlToParse = queries.Query(sessionId, "ARSQRY", XmlIn);
}
因此,我的XML将位于XmlToParse变量中。。。。这就是我需要进入我的网格


提前谢谢

您可以从字节数组中获取字符串,然后像xml一样使用它。例如:

        //buff is your byte array
        string xmlStr = Encoding.UTF8.GetString(buff);
        //now xmlStr contains your xml data and you can do something with it. 
        //For example load to xmlDocument
        XmlDocument doc = new XmlDocument();
        doc.LoadXml(xmlStr);

请尝试此操作或指定的Data-context。它仍然使用源文件中的XML。。。我的内存中只有XML,不知道如何在网格上显示这些节点。谢谢,我会很快尝试并告诉你我的结果