提出问题提出问题
 

已答复From datatable to xaml table document

答案

  • 2009年7月3日 15:12Kenneth Haugland 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     已答复
    Hi

    I do not understand what you mean... If you a datatable and want to make a XML tabel use WriteXML()
    If you have a XML table and want it in a datatable use ReadXML()


    well actually i was expecting to get the table directly from the datatable

    Get what? The xml tabel?

    Kenneth

全部回复

  • 2009年7月3日 9:41Myexp 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     
    Hi, Do you want to show the datatable data as table on the window? http://msdn.microsoft.com/en-us/library/ms750416.aspx
    You can not expect datatable to generate the code, it can only generate xml code once you call WriteXml method.
    Experience
  • 2009年7月3日 13:38marck68 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     
    well actually i was expecting to get the table directly from the datatable
  • 2009年7月3日 15:12Kenneth Haugland 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     已答复
    Hi

    I do not understand what you mean... If you a datatable and want to make a XML tabel use WriteXML()
    If you have a XML table and want it in a datatable use ReadXML()


    well actually i was expecting to get the table directly from the datatable

    Get what? The xml tabel?

    Kenneth
  • 2009年7月3日 21:14marck68 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     
    xaml table
  • 2009年7月3日 23:40Kenneth Haugland 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     
    dim  ds as new dsystem.data.dataset
    ds.ReadXML(filename)

    and you will have the datatable.... if its from a file
    Kenneth
  • 2009年7月4日 3:38Myexp 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     
    marck, 

    kenneth's post is what I mean, save your data to xml and read from it with ReadXml or WriteXml. But now I confuse with your requirement of XAML Table
    You want some method to generate xaml code for the DataTable? That is not supported. 

    Experience
  • 2009年7月9日 9:43Jim Zhou - MSFT版主用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     

    Hi,

     

    I think Kenneth Haugland has provided a good post in your case. As far as in know, there is no direct approach to make conversion from a ADO.NET DataTable to a Table of type Block in WPF. You need to write your own code to wrap DataTable as a Table using TableColumn  and TableRow.

     If you are still having any issues with this, you can elaborate on you scenario. Some sample code will be much better for others to understand you.

     

    Thanks.

  • 2009年7月9日 9:48Kenneth Haugland 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     
    If you do have a XAML table and want to read it... I suggest you convert it to a txt file and read line by line.... It will be a tremendus task... If you can store and read it as a XML table you will save a lot of trouble....


    Kenneth