WPF User Control DataContext

WPF User Control DataContext

Old forum URL: forums.lhotka.net/forums/t/6756.aspx


Brette.Net posted on Tuesday, April 07, 2009

Hello I hope someone here can help me with what I thought would be a very simple problem. My hope is that it still is :-)

I have the following object graph.

Contact = Root

AddressCollection = Editable Child Collection

Address = Editable Collection Item

To handle address edits/updates/deletes I have created a user control.

<UserControls:Address Grid.Row="2" Grid.Column="0" DataContext="{Binding Path=Contact.Addresses, Mode=TwoWay}"></UserControls:Address>

The save button for the Contact object is on the .xaml that hosts the user control.when save save is clicked I set the Contact Dependancy property to the 'new' version of the contact object returned from CSLA. However my address control does not get the new AddressCollection?

My thought was that since I have bound the datacontext of the user control to the Contact.Addresses object that if Contact was set to a new object the user control would be rebound etc...

 

Am I way off base here?

 

Brette

Copyright (c) Marimer LLC