views:

1963

answers:

2
+4  A: 

When you use Dependency Properties, the Setters will not be called by bindings, instead they change the value directly (using SetValue or something similar).

Try adding a PropertyChangedCallback, and set a breakpoint in there to see if the value is changed from the GridView.

public static readonly DependencyProperty BoolProperty =
    DependencyProperty.Register("Bool", typeof(bool), typeof(TestRow), new UIPropertyMetadata(false, OnBoolChanged));
private static void OnBoolChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
    //this method will be called everytime Bool changes value
}
Bubblewrap
AAGH. I've used that in the past too, but today it escaped me. Thanks!
Joe
+1  A: 

The property setters will NOT be called from WPF if they are dependency properties. Those are used as CLR conveniences and get called by code which is not aware of DependencyProperty.

The WPF code will do:

yourControl.SetValue(TestRow.StringProperty, someValue);

Not:

yourControl.String = someValue;

You need to hook the DepedencyPropertyChanged event to hear the changes.

sixlettervariables