
Thank you.
How can I bind to that value? I've tried the following:
Binding captionBinding = new Binding("CaptionWidth");
captionBinding.Mode = BindingMode.TwoWay;
captionBinding.Source = this;
propertyGrid.Columns[0].GetColumnDefinition().SetBinding(ColumnDefinition.WidthProperty, captionBinding);
Binding valueBinding = new Binding("ValueWidth");
valueBinding.Mode = BindingMode.TwoWay;
valueBinding.Source = this;
propertyGrid.Columns[1].GetColumnDefinition().SetBinding(ColumnDefinition.WidthProperty, valueBinding);
public static readonly DependencyProperty CaptionWidthProperty =
DependencyProperty.Register("CaptionWidth", typeof(GridLength), typeof(Properties),
new FrameworkPropertyMetadata(new GridLength(1, GridUnitType.Star),
new PropertyChangedCallback(OnCaptionWidthChanged)));
public static readonly DependencyProperty ValueWidthProperty =
DependencyProperty.Register("ValueWidth", typeof(GridLength), typeof(Properties),
new FrameworkPropertyMetadata(new GridLength(100, GridUnitType.Pixel),
new PropertyChangedCallback(OnValueWidthChanged)));
public GridLength CaptionWidth {
get { return (GridLength)GetValue(CaptionWidthProperty); }
set { SetValue(CaptionWidthProperty, value); }
}
public GridLength ValueWidth {
get { return (GridLength)GetValue(ValueWidthProperty); }
set { SetValue(ValueWidthProperty, value); }
}
private static void OnCaptionWidthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) {
}
private static void OnValueWidthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) {
}
But OnCaptionWidthChanged & OnValueWidthChanged are never called.
What am I doing wrong?
Best Regards,
Gustavo Guerra