Telerik blogs



A client has recently asked for these little fancy math toolbars in the column header. I found it a great idea and thought it might be useful to share the way of implementing this with RadGridView for Silverlight.


*Since RadGridView for WPF shares the same code base  the approach bellow may be used for both platforms ( Silverlight and WPF ) .


Things are easy with RadGridView !


To have this in your project follow these three easy steps :


1. Copy the MathToolBar user control from the attached sample project (MathToolBar.xaml, MathToolBar.cs).

2. Replace the default header in the column with the user control.

<telerik:GridViewDataColumn ...
 <local:MathToolBar HeaderText="Value1"/> 


3. Adjust namespaces.



* If  you need different aggregate functions , you may choose from the standard aggregate functions offered by RadGridView,

or you may provide a custom one. Actually the Standard Deviation function in this example is a custom one. More info on how this is implemented may be found in this online example.


* if you need to customize the look of the toolbar ( e.g. add/remove buttons, change colors  ), the place to tamper is MathToolBar.xaml.


Comments are disabled in preview mode.