How to: Add Computed Properties on the Client
To add a computed property
Imports OpenRiaServices.Client Namespace Web Partial Public Class Employee Inherits Entity ReadOnly Property TotalOffHours() As Integer Get Return Me.SickLeaveHours + Me.VacationHours End Get End Property Private Sub OnSickLeaveHoursChanged() Me.RaisePropertyChanged("TotalOffHours") End Sub Private Sub OnVacationHoursChanged() Me.RaisePropertyChanged("TotalOffHours") End Sub End Class End Namespaceusing OpenRiaServices.Client; namespace RIAServicesExample.Web { public partial class Employee : Entity { public int TotalOffHours { get { return this.SickLeaveHours + this.VacationHours; } } partial void OnSickLeaveHoursChanged() { this.RaisePropertyChanged("TotalOffHours"); } partial void OnVacationHoursChanged() { this.RaisePropertyChanged("TotalOffHours"); } } }<dataForm:DataField Label="Total Off Hours"> <TextBox Text="{Binding TotalOffHours, Mode=OneWay}" /> </dataForm:DataField>
Last updated