Calculated columns are used as an easy to implement alternative to XAML Value Converters and XAML MultiBinding.
Calculated columns are implemented by extending the generated record class source code with your own code. This is achieved by creating a partial class.
VenturaSQL Studio will add a, commented out, code template at the bottom of the generated recordset source file, when data binding code generation is turned on:
You cannot uncomment and modify the code in the generated recordset (.cs) file as it will be overwritten each time you regenerate the recordset.
Copy the template into a separate C# (.cs) file, and place the file in a folder that is not managed by VenturaSQL Studio.
A suggested filename for the extension is adding the word "Extension" to the original recordset name. For example CustomerRecordsetExtension.cs.
This is a customer table:
We are going to define an extra (calculated column) property called FirstNameLastName. The property combines the first and last name of the customer.
In XAML data binding, a property that is changed must raise the PropertyChanged event of the INotifyPropertyChanged interface. Usually this is done via a method called OnPropertyChanged().
The PropertyChanged event instructs the UI to update the screen contents with the new property value.
When the FirstName or LastName property changes value, then the FirstNameLastName property must also call OnPropertyChanged.
To let you know you that a column value was just modified, the runtime calls a partial method named OnAfterPropertyChanged() with the property name as a parameter.
The sample code checks if the FirstName or LastName properties changed value, and the calls OnPropertyChanged() for the FirstNameLastName property.
public partial class CustomerRecord
partial void OnAfterPropertyChanged(string propertyName)
if (propertyName == "FirstName" || propertyName == "LastName")
public string FirstNameLastName
return this.FirstName + " " + this.LastName;
Make sure that you enter the property names correctly (case sensitive!) inside the OnAfterPropertyChanged method.
This is the sample in action:
rs.LastName = "NEWLASTNAME";