Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
455
Calculated fields in XamDataGrid
posted

Hi,

I am trying to add calculated fields in XamDataGrid. From feature browser it seems that using UnBoundFields is a option (let me know if there are more).

Problem statement for me would be

 

public class Order : INPC {

 

public double Quantity {

get {return _qty;}

set { _qty = value; INPC("Quantity")}

}

public double  CurrentPrice {

get {return _currentPx ; }

set {_currentPx = value ; INPC ("CurrentPrice")

}

/* fun starts here */

public double Notional {

get {return Quantity * CurrentPrice ;}

}

}

 

to have a calculated field (unsaid that i have a observableCollection<Order> and this is my dataSource and i have autogenerate col set to true)

Option #1 : Having a property Notional and raise its INPC when ever a dependent changes , this seems straight ; how ever for my use case i have lots of such calculated fields and some times the sources of values are cant be clubbed. This makes raising INPC difficult if not impossible. Also there is the part of registering dependencies of each calculated field.

 

Option #2 : add Notional as a unbound field in Grid and make it dependent on Columns 1 & 2 (qty , px) and let Grid handle it. Where it would calculate (based on a converter , event) and value is updated.

Before we spend effort and time on #1 , we wanted to find out if #2 is possible and more importantly is it performant (~10000 rows with , each column dependent on 2-3 fields , update rate of ~500 ms possible on dependent fields )

Please let me know if you need more details , thanks in advance.