Home Forums WPF controls Xceed DataGrid for WPF Binding Complex Objects to the DataGrid

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

    I have an Object Collection that I need to bind to the XCeedDatagrid.

    Earlier we used to bind our data in the following manner which gave us the results we wanted.

    However, I am a bit unclear on how we can traverse collections like we could (see code snippet), something like “Binding Path=Deals/DealParty.Text” (where deals is a collection), or PrimaryContact.FullName(where PrimaryContact is an strongly typed object within the Bound Collection of objects.

    <ListView Name=”RequestListing” ItemsSource=”{Binding}” IsSynchronizedWithCurrentItem=”True”>
    <ListView.View>
    <GridView AllowsColumnReorder=”True” ColumnHeaderToolTip=”Pending Requests”>
    <GridViewColumn DisplayMemberBinding=”{Binding Path=RequestStatus.Description ,Mode=OneWay}” Header=”Status” Width=”100″/>
    <GridViewColumn DisplayMemberBinding=”{Binding Path=ID ,Mode=OneWay}” Header=”Region” Width=”100″/>
    <GridViewColumn DisplayMemberBinding=”{Binding Path=Deals/DealParty.Text}” Header=”Parties Involved” Width=”100″/>
    <GridViewColumn DisplayMemberBinding=”{Binding Path=Deals/DealDescription ,Mode=OneWay}” Header=”Deal Description” Width=”Auto”/>
    <GridViewColumn DisplayMemberBinding=”{Binding Path=Deals/Products.Text}” Header=”Product” Width=”Auto”/>
    <GridViewColumn DisplayMemberBinding=”{Binding Path=Deals/EquityRaised}” Header=”Size(USD)” Width=”Auto”/>
    <GridViewColumn DisplayMemberBinding=”{Binding Path=PrimaryContact.FullName}” Header=”Send By” Width=”Auto”/>
    <GridViewColumn DisplayMemberBinding=”{Binding Path=LeadBanker.Text}” Header=”Lead Banker” Width=”Auto”/>
    <GridViewColumn DisplayMemberBinding=”{Binding Path=UpdateDate}” Header=”Request Date” Width=”Auto”/>
    </GridView>
    </ListView.View>
    </ListView>

    Imported from legacy forums. Posted by Leon (had 2042 views)

    User (Old forums)
    Member
    Post count: 23064

    Based on the thread in this forum i managed to get the solution to my own problem.

    <Grid.Resources>
    <xcdg:DataGridCollectionViewSource x:Key=”listing” Source=”{Binding}” AutoFilterMode=”And” DefaultCalculateDistinctValues=”False” >
    <xcdg:DataGridCollectionViewSource.ItemProperties>
    <xcdg:DataGridItemProperty Name=”RequestStatus.Description” Title=”Status” DataType=”{x:Type s:String}” IsReadOnly=”True”/>
    <xcdg:DataGridItemProperty Name=”ID” Title=”ID”/>

    <xcdg:DataGridItemProperty Name=”DealParty.Text” Title=”Parties Involved” ValuePath=”Deals/DealParty.Text” DataType=”{x:Type s:String}” IsReadOnly=”True”/>
    <xcdg:DataGridItemProperty Name=”DealDescription” Title=”Description” ValuePath=”Deals/DealDescription” DataType=”{x:Type s:String}” IsReadOnly=”True”/>
    <xcdg:DataGridItemProperty Name=”Products.Text” Title=”Product” ValuePath=”Deals/Products.Text” DataType=”{x:Type s:String}” IsReadOnly=”True”/>
    <xcdg:DataGridItemProperty Name=”EquityRaised” Title=”Size(USD)” ValuePath=”Deals/EquityRaised” DataType=”{x:Type s:String}” IsReadOnly=”True”/>
    <xcdg:DataGridItemProperty Name=”PrimaryContact.FullName” Title=”Sent By” DataType=”{x:Type s:String}” IsReadOnly=”True”/>
    <xcdg:DataGridItemProperty Name=”LeadBanker.Text” Title=”Lead Banker” DataType=”{x:Type s:String}” IsReadOnly=”True”/>
    <xcdg:DataGridItemProperty Name=”UpdateDate” Title=”Request Date” DataType=”{x:Type s:String}” IsReadOnly=”True”/>
    </xcdg:DataGridCollectionViewSource.ItemProperties>

    <xcdg:DataGridCollectionViewSource.SortDescriptions>
    <compModel:SortDescription PropertyName=”ID” Direction=”Descending”/>
    </xcdg:DataGridCollectionViewSource.SortDescriptions>

    </xcdg:DataGridCollectionViewSource>
    </Grid.Resources>

    Imported from legacy forums. Posted by Leon (had 3097 views)

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