locked
Problems Binding a Datatable to Grid RRS feed

  • Question

  • I was wondering if it was possible to bind a datatable to a grid?

    I already used a gridview with a list view, but I want the user to be able to change the value in the grid, and it will change the value in the datatable through databinding. Realizing I couldn't do this with a gridview, I decided to use a grid and am having trouble.

    Is it possible to do what I am asking with a grid or something else?

    If it is, can someone help me...

    Thanks,

    Jon
    Friday, July 25, 2008 7:37 PM

Answers

  • If you are talking about a standard WPF Grid control (<Grid></Grid>) then no, you cannot databind a DataTable to this control.  The WPF Grid is purely for layout purposes, not for display of data in that way.  The ListBox or ListView controls are available to show lists of data (seems you're making use of the ListView/GridView per your question), and I believe Microsoft will be releasing a WPF DataGrid sometime in the future. 

    Otherwise, you could look into some 3rd party controls, such as the Xceed WPF Grid: http://xceed.com/Grid_WPF_Demo.html, which are true DataGrids.

    Hope this helps.
    Brian

    Brian Schwalm • www.anythinksolutions.com
    • Proposed as answer by Brian Schwalm Tuesday, July 29, 2008 7:27 PM
    • Marked as answer by Jonathon R Thursday, July 31, 2008 5:44 PM
    Saturday, July 26, 2008 12:08 AM