For instance, I want to know the change in the Grid.Row property in the MyGrid
class. It is the following codes that I tried.
public class MyGrid : Grid
{
static MyGrid()
{
FrameworkPropertyMetadata metaData =
new FrameworkPropertyMetadata(0);
metaData.PropertyChangedCallback += OnAttachedRowChanged;
Grid.RowProperty.OverrideMetadata( typeof(MyGrid), metaData );
}
private static void OnAttachedRowChanged(
DependencyObject d, DependencyPropertyChangedEventArgs e)
{
// It is not called.
MessageBox.Show( "Call OnAttachedRowChanged" );
}
}

I want to specify attached property for Binding.
Nipam N. Patel
Please teach the method of receiving the notification.
Pavan Apuroop
I'm not sure why that OverrideMetadata isn't working, but another thing you could try is to override the OnPropertyChanged method of Grid. In there, you can look for and handle the case where the RowProperty has changed. (Just make sure you also call base.OnPropertyChanged from your override.)
Leonard51607
Amos Soma
try
<SolidColorBrush Color="{Binding Path=(ColorComboBox.ItemColor), RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
Derek Smyth
Thank you.
It tried immediately.
However, the exception has been generated.
By the way, I am using June CTP.
progames25
Thank you.
It operated by specifying xmlnamespace.
<SolidColorBrush Color="{Binding Path=(local:ColorComboBox.ItemColor), RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
The Philosiphiser
It is not referred in the following codes though I want to relate to attached
property with Binding.
System.Windows.Data Error: 35 : BindingExpression path error: 'ColorComboBox' property not found on 'object' ''ComboBoxItem' (Name='')'. BindingExpression:Path=ColorComboBox.ItemColor; DataItem='ComboBoxItem' (Name=''); target element is 'SolidColorBrush' (HashCode=60790550); target property is 'Color' (type 'Color')
figuerres
I want to learn the change of child's Grid.Row with MyGird.
However, it is not possible to achieve it by the method.