2014-01-30 50 views
0

我正在使用caliburn micro和Telerik控件的應用程序。GridViewDataColumn SourceUpdated子屬性

我有一個RadGrivView綁定到PurchaseDetails的集合,該行的Purchase Price爲可編輯列。在更新PurchaseDetails對象上的PurchasePrice值時,綁定工作正常,但我需要更新綁定到其他對象的View上的其他值。

無論何時更新PurchasePrice,我都想在Model上引發一個事件。 我試過NotifyOnSourceUpdated,在列和網格級別沒有運氣。

<telerik:RadGridView Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" 
          AutoGenerateColumns="False" 
          ShowGroupPanel="False" 
          ItemsSource="{Binding PurchaseDetails}"> 
      <telerik:RadGridView.Columns> 
       <telerik:GridViewDataColumn DataFormatString="N2" 
              SourceUpdated="FrameworkContentElement_OnSourceUpdated" 
              TargetUpdated="FrameworkContentElement_OnTargetUpdated" 
              DataMemberBinding="{Binding .PurchasePrice, Mode=TwoWay, 
               NotifyOnSourceUpdated=True,NotifyOnTargetUpdated=True}"/> 
       <telerik:GridViewDataColumn DataFormatString="N2" 
              DataMemberBinding="{Binding .Amount.Value}" IsReadOnly="True" /> 
      </telerik:RadGridView.Columns> 
     </telerik:RadGridView> 

回答

0

INotifyPropertyChanged Interface是(部分)爲此設計的。如果您在PurchaseDetails課程中正確實施了該課程,那麼您將能夠處理該對象上的INotifyPropertyChanged.PropertyChanged事件:

SelectedPurchaseDetail.PropertyChanged += Detail_PropertyChanged; 

... 

private void Detail_PropertyChanged(object sender, PropertyChangedEventArgs e) 
{ 
    if (e.PropertyName == "PurchasePrice") 
    { 
     // PurchasePrice was changed... update other view model properties here 
    } 
}