绑定厚度BO< =>用户控件

时间:2012-03-22 14:15:59

标签: .net wpf vb.net binding

我有一个MyBussinessObject类。和(WPF)MyUserControl。

在UserControl中,我尝试将BO的属性与MyUserControl的属性同步。通过例如:

Me._BindingMarge = New Binding("Marge")
Me._BindingMarge.Source = Me._MyBussinessObject
'Me._BindingMarge.BindsDirectlyToSource = True'
BindingOperations.SetBinding(Me, MarginProperty, Me._BindingMarge)

Me._BindingAlignementVertical = New Binding("AlignementVertical")
Me._BindingAlignementVertical.Source = Me._MyBussinessObject
Me._BindingAlignementVertical.BindsDirectlyToSource = True
BindingOperations.SetBinding(Me, VerticalAlignmentProperty, Me._BindingAlignementVertical)

MyBusinessObject继承继承INotifyPropertyChanged的MyBaseElement,其中<​​/ p>

  Public Property Marge As System.Windows.Thickness
    Get
      Return Me._Marge
    End Get
    Set(ByVal value As System.Windows.Thickness)
      Me._Marge = value
      Me.OnPropertyChanged("Marge")
    End Set
  End Property

  Public Property AlignementVertical As System.Windows.VerticalAlignment
    Get
      Return Me._AlignementVertical
    End Get
    Set(value As System.Windows.VerticalAlignment)
      Me._AlignementVertical = value
      Me.OnPropertyChanged("AlignementVertical")
    End Set
  End Property

当我双击MyUserControl时,我打开一个新窗口,我通过了MyBusinessObject。 在那里,我修改了MyBO的一些属性,并期望这些修改立即反映在MyUserControl中。

我看到了对象的反映,但没有反映边缘(厚度,Marge-fr)。

我做错了什么?

0 个答案:

没有答案