views:

322

answers:

0

Hello,

I have classes as following:

public class Property  
{
    public string PropertyName { get; set; }
    public int SumSubPropertValue;
    private List<SubProperty> propertyList;

    public void CalculateSumSubPropertValue
    { // implementation}
}

public class SubProperty
{
    public string SubPropertyName { get; set; }
    public int SubPropertyValue { get; set; }
}

I have grouped the rows in datagrid on PropertyName . When the user clicks on PropertyName expnader the columns should display SubPropertyName and SubPropertyValue.

Also SumSubPropertValue should appear in front of PropertyName in the expander header.

My Datagrid is bound to a CollectionViewSource as follows:

CollectionViewSource view = new CollectionViewSource();

view.Source = infoList;

view.GroupDescriptions.Add(new PropertyGroupDescription("PropertyName"));

Where infoList is

ObservableCollection<Property>.

My datagrid colmns look like

<my:DataGrid.Columns>

<my:DataGridTextColumn Header="SubPropertyName" Binding="{Binding SubPropertName}" Width="*"/>

 <my:DataGridTextColumn Header="SubPropertyValue" Binding="{Binding SubPropertyValue}" Width="*"/>

</my:DataGrid.Columns>

Can someone help me with it?