RowDetailsTemplate Binding

Nov 13, 2009 at 12:26 PM

How can I upgrade all information of my row detail when I change the collection of parent row? For each row I have one ListView that is my detail, this ListView represent a Collection of my Entity. This is one case of Employee-Phones. In row I show employee information and his rowdetail I show phones numbers but, when I upgrade one phone this ListView doesn't upgrade!

<my:DataGrid AutoGenerateColumns="True" Height="200" Name="Grid" 
             RowDetailsVisibilityMode="VisibleWhenSelected">
    <my:DataGrid.RowDetailsTemplate>
        <DataTemplate>
            <ListView ItemsSource="{Binding Phones}">
                <ListView.View>
                    <GridView>
                        <GridView.Columns>
                            <GridViewColumn Header="Id" DisplayMemberBinding="{Binding Id}">
                            </GridViewColumn>
                            <GridViewColumn Header="Number" DisplayMemberBinding="{Binding Number}">
                            </GridViewColumn>
                        </GridView.Columns>
                    </GridView>
                </ListView.View>
            </ListView>
        </DataTemplate>
    </my:DataGrid.RowDetailsTemplate>
</my:DataGrid>

[DataContract]
public class Employee {
    long id;
    string name;
    ObservableCollection<Phone> phones;

    (...)
    
    [DataMember]
    public ObservableCollection Phones {
        get { return phones; }
        set { phones = value; }
    }
}

I have the fellow code that upgrade my DataGrid.

public void Updated(Employee current) {
    Employee original = null;
    ObservableCollection<Employee> employees = Grid.ItemsSource as ObservableCollection<Employee>;
    try {
        original = employees.Single<Employee>(e => e.Id == current.Id);
    } catch {
        original = null;
    }
    //Update DataSource
    if (original != null)
        original = current;
}

When I call original = current Just row upgrade automatically but my rowdetail doesn't. Why? Anyone has any ideia of how can i fix it?

Thanks