Peter van Kekem
Peter van Kekem

Reputation: 1447

Double list - WPF Toolkit DataGrid

I have a datagrid from wpf Toolkit, with the itemsource binded to a Observable<Item>. In the Item Class, I have another Observable<bool> list containing the values to be displayed.

I want to display these values in a custom template. If possible, I want to show other rows as well (which are normal Properties).

How can I perform this? Thank you for your answers.

Update (just to make clear): the second list should be displayed in normal columns, not as master/detail. Imagine the second list would contain 2 bools, and the Item class contains 1 extra property. In that case, 3 columns should be shown.

Upvotes: 1

Views: 977

Answers (2)

RockWorld
RockWorld

Reputation: 1288

You can write attached property to datagrid which will create additional columns for you on grid. This property implementor will define binding with individual Observable values.

Upvotes: 1

Sergey Vedernikov
Sergey Vedernikov

Reputation: 7744

You can create second datagrid and bind SelectedItem.Items from first grid to itemssource of second. Or you can include second datagrid in row details of your datagrid like this:

<DataGrid.RowDetailsTemplate>
    <DataTemplate>
        <DataGrid ItemsSource="{Binding Items}"/>
    </DataTemplate>
</DataGrid.RowDetailsTemplate>

Take a look at this examples and this

Upvotes: 2

Related Questions