<TextBox > Name="txtAirWayBillTotal" > Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=AirWayBillTotal}" > Grid.Column="3" > Grid.Row="5" > Height="23" > HorizontalAlignment="Stretch" > Margin="0" > VerticalAlignment="Top" > Width="Auto" > Grid.ColumnSpan="2" > HorizontalContentAlignment="Right" > FontWeight="Bold" IsReadOnly="True" Focusable="False" />>
private decimal airwaybillTotal; > > public decimal AirWayBillTotal > { > get > { > return this.airwaybillTotal; > } > > set > { > if (value != this.airwaybillTotal) > { > this.airwaybillTotal = value; > this.OnPropertyChanged("AirWayBillTotal"); > } > } > } >>
void AirWayBillDetail_StateChange(mmBaseBusinessObject bizObj, mmBusinessStateChangeEventArgs e) > { > if (e.State == mmBusinessState.Retrieved) > { > // Store the Air WayBill Detail in the DataGrid's data context > this.grdAirWayBillDetails.DataContext = this.AirWayBillDetail.EntityList; > > // Hide the new item row place holder in the Air WayBill Detail DataGrid > ((IEditableCollectionView)CollectionViewSource.GetDefaultView(grdAirWayBillDetails.ItemsSource)).NewItemPlaceholderPosition = > NewItemPlaceholderPosition.None; > } > //this.ShowAirWayBillTotal(); > if (this.AirWayBillDetail.EntityList != null) > { > this.AirWayBillTotal = this.AirWayBillDetail.EntityList.Sum(x => x.awd_amount); > foreach (var c in this.AirWayBillDetail.EntityList) > { > c.PropertyChanged += CollectionItemChanged; > } > } > > }>
void CollectionItemChanged(object sender, PropertyChangedEventArgs e) > { > if (e.PropertyName == "awd_amount") > { > AirWayBillTotal = AirWayBillDetail.EntityList.Sum(x => x.awd_amount); > OnPropertyChanged("AirWayBillTotal"); > } > }>