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

6 posts, 1 answers
  1. Stanislav
    Stanislav avatar
    1 posts
    Member since:
    May 2012

    Posted 13 Jan 2013 Link to this post

    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
  2. Stanislav
    Stanislav avatar
    1 posts
    Member since:
    May 2012

    Posted 14 Jan 2013 Link to this post

    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
  3. Stanislav
    Stanislav avatar
    1 posts
    Member since:
    May 2012

    Posted 14 Jan 2013 Link to this post

    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
  4. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 17 Jan 2013 Link to this post

    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
  5. Stanislav
    Stanislav avatar
    1 posts
    Member since:
    May 2012

    Posted 17 Jan 2013 Link to this post

    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
  6. Answer
    Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 18 Jan 2013 Link to this post

    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
Back to Top