Unfortunately I don't have code anymore. Have to replace it with my own delegate which works fine. But in general as I remember it looks like:
Tile.cs
public class Tile : INotifyPropertyChanged
{
public double Width
{
set
{
if( PropertyChanged != null )
PropertyChanged( this, null );
}
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
#endregion
}
Pattern.cs
public class Pattern
{
public Pattern()
{
Tile = new Tile();
Tile.PropertyChanged += new PropertyChangedEventHandler( OnTilePropertyChanged );
}
void OnTilePropertyChanged( object sender, PropertyChangedEventArgs e )
{
}
public Tile Tile { get; set; }
}
PatternProperties.xaml:
<UserControl>
<Canvas>
<TextBox Height="20" x:Name="WidthCtrl" Width="50" Canvas.Left="70" Canvas.Top="85" FontSize="12" Text="{Binding Tile.Width, Mode=TwoWay}" AcceptsReturn="True"/>
</Canvas>
</UserControl>
Page.xaml.cs
private void ShowPatternProperties( UserControl properties )
{
properties.Visibility = Visibility.Visible;
properties.DataContext = plan.Pattern; // property type of Pattern, see class above
}
So user changes width in UI control, which updates class object property and the last one notifies other class about that change.