Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #23709 |

    Hi.

    We are trying to make a grid wrapper (custom control) which binds to a dataset with multiple tables.
    The column bindings are specified in a field list (List collection).

    private DataSet _datasource = new DataSet();
    private List _fieldList;

    private void getDataToXaml()
    {
    _fieldList = getFields() ……
    _datasource = getData(_fieldList) ….. //tables based on the _fieldList
    }

    private void FillGridWithData()
    {

    foreach (Field field in _fieldList)
    {
    Binding bb = new Binding(field.Binding); //could be person.Name or person.City_Id or city.CityName
    Column column = new Column();
    column.DisplayMemberBinding = bb;
    column.FieldName = field.Name;
    column.Title = field.Caption;

    uxGrid.Columns.Add(column);
    }

    //this works if we want to bind to only 1 table in the _dataset
    //uxGrid.ItemsSource = Datasource.Tables[0].DefaultView;

    //we want to bind to multiple tables in the dataset, with relation between them
    uxGrid.DataContext = _datasource; //but this does not work

    How do I bind to a dataset with multiple tables and where the row will display fields from the main table and the related tables?

    Thanks
    Agnar

    Imported from legacy forums. Posted by Agnar (had 642 views)

    Xceed Support
    Member
    Post count: 5658

    Hi Agnar,

    If by “[binding] to a dataset with multiple tables and where the row will display fields from the main table and the related tables”, you mean to display master (main table) and details rows(relations) in the same grid, then that’s a scenario that is currently not supported.

    While we have plans to implement such Hierarchical Master/Detail feature for the DataGrid for WPF, the exact timeframe is not availlable.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 207 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks for your answer Marc.

    Hierarchical Master/Detail feature for det datagrid will be welcome.

    But that wasn’t what I meant.
    I just want to show rows with columns from related tables in a dataset.
    I could write a select query which combine these fields, but that is not desirable.
    So, we have a form with a dataset populated with 3 or more tables with relations.
    And one row in the grid will display for example “person.Name, person.City_Id, city.CityName” etc….

    Is that possible in code behind, not in xaml?

    Thanks
    Agnar

    Imported from legacy forums. Posted by Agnar (had 3197 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.