This is a migrated thread and some comments may be shown as answers.

GridViewExpressionColumn with different expressions per row/cell

5 Answers 184 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Marcel
Top achievements
Rank 1
Marcel asked on 13 Feb 2012, 08:22 PM
Hello,

I'm evaluating different WPF grids for a current software project in our company. By reading your documentations, forum threads and trying your demos, I couldn't find out if your GridView control could meet our special requirements:

- multiple grouping (could be fixed groups, not necassary for user to change grouping at runtime)
- different formulas/expressions per cell not just per column
- formulas/expressions related to other cells in other columns and rows, i.e. formula in cell A1: "B1 + C3"
- possibility for user to change the formulas (maybe with your expression editor?)

Could you tell me if this is somehow possible and give me an example?

5 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 14 Feb 2012, 07:54 AM
Hi Marcel,

You can achieve your requirements as follows:
1. You can define group descriptors in xaml/ code-behind so that they are created initially and cancel grouping event afterwards/ remove the group panel.
2/3. You can work with our GridViewExpressionColumn and define the expression you want to be applied. Could you clarify what do you mean by setting an expression per cell, not per column ? Do you expect to be able to define different expressions for different items in a column ? 
4. You can work with the expression editor as illustrated in our demos. Furthermore, you can take a look at this forum thread for additional information.
Let me know in case you need any further assistance. 


Greetings,
Maya
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Marcel
Top achievements
Rank 1
answered on 14 Feb 2012, 09:03 AM
Hi Maya,

Thanks for your quick response!

2.: Yes I mean different expressions per item. So i.e. the ExpressionColumn-item[1] could have another expression as ExpressionColum-item[2].

3.: By related to other cells/rows I mean, i.e. you have a grid with 3 columns: ExpressionColumn, UnitPrice and Budget. Is it possible to have an expression like "UnitPrices[2] * Budgets[10]" in ExpressionColumn[1]. The different indexes of the items stand for different rows (item levels). In your demo the expression is always related to the same row (item level).

Greetings
Marcel
0
Maya
Telerik team
answered on 15 Feb 2012, 10:45 AM
Hi Marcel,

Basically, DataContext of a particular row is the corresponding data item and you can make calculations on it out-of-the-box with GridViewExpressionColumn. If you want to perform some custom logic, you will need to implement it in your business object and depends entirely on the structure of your application.  

Greetings,
Maya
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Marcel
Top achievements
Rank 1
answered on 15 Feb 2012, 11:11 AM
Hi Maya,

ok, but can you tell me how high the effort is and what else I would have to implement manually? Just changing businss object won't do the trick, I think. Are the following steps the necessary steps I would have to do?

1. Change business object
2. Change/extend the GridViewExpressionColumn class to store different expressions per item
3. Change/extend the ExpressionEditor class/control to give the user the opertunity to enter expressions like this "UnitPrices[2] * Budgets[10]"

Is this possible at all or are the controls/classes sealed? Do you have examples how to do this?

Greetings,
Marcel
0
Maya
Telerik team
answered on 15 Feb 2012, 01:08 PM
Hi Marcel,

Generally, what you want to accomplish may lead to quite undesirable results and could break the whole data engine of RadGridView.  Each row depends on the underlying data item, each column - on the corresponding property. The case with GridViewExpressionColumn is a bit different as it does not expect a property, but rather an expression. However, in this situation again the expression should be the same for all items and it is defined on column, not on row level. 
All the filtering/ grouping/ sorting functionality depends on this logic and changing it could result in unwanted behavior. 

Greetings,
Maya
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
GridView
Asked by
Marcel
Top achievements
Rank 1
Answers by
Maya
Telerik team
Marcel
Top achievements
Rank 1
Share this question
or