Home Forums WPF controls Xceed DataGrid for WPF Binding to hierarchical objects

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

    Hi,

    I tried looking at previous posts but didn’t find exactly what I was looking for. I wanted to know if this grid has the ability to display hierarchical data from an object collection.

    A simple example: I have a transaction class with Item details. The transaction represents all of the info about the transaction: Date of Trx, Total Sale, Customer Number, etc. The Details would represent the line items (individual list of items sold within that transaction).

    Inside the “Transaction” object, there would be a property called LineItems which would be an arraylist or a collection of “Items” which has its own set of properties.

    Is there support in the Xceed Datagrid to do something like this? I cannot use DataSets, DataTables because of the way the application is tier’d.

    Also, if there is a way, can you specify how to do it via C# code (rather than, or in addition to XAML).

    Thanks!

    Imported from legacy forums. Posted by Giovanni (had 1971 views)

    User (Old forums)
    Member
    Post count: 23064

    same problem here

    I have a List<Order> collection. Inside an order there is an Items Collection. I’m using an ObjectDataProvider which provides data to other controls xcept XceedDataGrid for Wpf.

    Both Order and Item implements INotifyPropertyChange, and I have also added and defined DataGrid’s ItemsSource.

    Here are parts of the code which may help to understand the problem.

    Object Data Provider
    <ObjectDataProvider x:Key=”OrderList” ObjectType=”{x:Type src:OrderModule.OrderLogic}” MethodName =”GetOrdersWaitingAuthorization” />

    DataTemplate
    <DataTemplate x:Key=”ProductDataTemplate”>
    <StackPanel >
    <TextBlock Text=”{Binding Path =Items.Product.Code, Mode=TwoWay}”/>
    </StackPanel>
    </DataTemplate>

    The Xceed Grid
    <Custom:DataGridControl ItemsSource=”{Binding Source={StaticResource MyList},Path=Order.Items}” >
    <Custom:DataGridControl.Columns>
    <Custom:Column Title= “Product” VisiblePosition =”1″
    CellContentTemplate=”{StaticResource ProductDataTemplate}”/>
    </Custom:DataGridControl.Columns>
    </Custom:DataGridControl>

    Hope someone will answer to this.

    Thanx in advance.

    Imported from legacy forums. Posted by wavewizard (had 3251 views)

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