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

The order of columns in the header and in the row are different

5 Answers 58 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Stanislav
Top achievements
Rank 1
Stanislav asked on 14 Jan 2013, 05:41 AM
Hello Telerik,

I have faced with an issue when the order of HeaderCells in RadGridView differs from the order of the Cells in the Rows. Because of this issue I can't get the value from the particular cell in the row by the index of the column with the specific text. I use the following algorithm to identify the cell:
1. I go through all HeaderCells in radGridView.HeaderRow and search for the header cell with the particular text;
2. Once I have identified the header cell, I remember the column index, and then go through all radGridView.Rows and compare the cell with the index to the expected value.

And here is an issue. The column index is 2, but the value in the Rows is stored in the cell with index 1. I can't make head or tail of this issue. One month ago everything worked perfectly.

How is this possible?

Kind Regards,
Stanislav Hordiyenko

5 Answers, 1 is accepted

Sort by
0
Stanislav
Top achievements
Rank 1
answered on 15 Jan 2013, 04:42 AM
Hello Telerik,

I took a look into XAML visual tree that is available in Telerik Testing Framework and found out that the order of HeaderCell in HeaderCells is reversed (from n..0). So it is not possible to identify the index based on the columns in header and then do a search in Rows.

We didn't change the version of used WPF controls. Could you be so kind to take a look into this matter.

Thank you.

Kind Regards,
Stanislav Hordiyenko
0
Stanislav
Top achievements
Rank 1
answered on 15 Jan 2013, 05:20 AM
Hello Telerik,

I have found the following update on your web site: http://www.telerik.com/products/silverlight/whats-new/release_notes/q2-2012-version-2012-2-607.aspx

For the GridView, there is a line: Setting display indices in reverse order for columns in XAML results in exception is now fixed.

Can this issue is somehow be related to my problem?

Thank you.

Kind Regards,
Stanislav Hordiyenko
0
Plamen
Telerik team
answered on 17 Jan 2013, 12:20 PM
Hi Stanislav,

I apologize for the delay in getting back to you on this. The problem is that the header cells are placed in the Visual Tree in reversed order and we are indexing the elements starting from the one that appear first in the tree. I discussed the issue with our WPF team and they confirmed the problem you are experiencing. According to them the issue is fixed in the latest internal build of the WPF controls. Please try that build and if you continue to have difficulty, please post your question in our WPF support forum. They should be able to assist you solving the issue. 

Regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Stanislav
Top achievements
Rank 1
answered on 18 Jan 2013, 03:11 AM
Hello Plamen,

Thank you for your response. It is pretty bizarre, because my code worked perfectly several month before. I talked to the development team and they reported that they didn't change the version of WPF controls. I checked this code on the previous version of Telerik Testing Framework, but the issue still exists. I can't make head or tail how it worked previously. I implemented workaround in my code, so there is no necessity to update WPF controls. It works.

Thank you again.

Kind Regards,
Stanislav Hordiyenko
0
Accepted
Plamen
Telerik team
answered on 18 Jan 2013, 12:23 PM
Hello,

I am glad to hear you got it working. You didn't share the workaround you are using, but here's one possible solution.
 
1. Find the count of all header cells (HeaderCells.Count) and assign the value to a local variable (i.e. "count")
2. Now, when you have the index of the header row cell you can easily calculate the index of the row cell like this:

int RowCellIndex = (count - HeaderCellIndex)

and use it like this:

gridView.Rows[1].Cells[RowCellIndex]


Kind regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Stanislav
Top achievements
Rank 1
Answers by
Stanislav
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or