Silverlight Data Grid control questions

Ask general questions here.
User avatar
Aracknid
Posts: 342
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Silverlight Data Grid control questions

Post by Aracknid » Mon Jun 27, 2011 7:14 pm

Hi,

I have a Silverlight Data Grid control, and it has some left most columns that are frozen in place. So when I scroll the columns only the ones on the right side move. It's possible for the column that I want to work with is not currently visible on the screen OR is only partially visible. If the entire column is not visible, than the elements in the column have the Visible property set to False. However, if it is partially visible (even if only 1 pixel wide), then it says it is visible. Either way, when I say ensurevisible, it does not scroll the entire column into view. I cannot figure out how to scroll it into view myself. The scroll bars within the grid do not seem to be detected by Ranorex Spy, and I cannot see any properties or methods to scroll the grid either.

Any ideas?

Thanks,

Aracknid

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Silverlight Data Grid control questions

Post by Support Team » Tue Jun 28, 2011 2:49 pm

Hi,

Would it be possible to send us a Ranorex Snapshot of your application to analyze the issue?
Currently we don't know such an issue. Instead of EnsureVisible did you try the Focus Method on such an element?

Regards,
Peter
Ranorex Team
.
Image

User avatar
Aracknid
Posts: 342
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: Silverlight Data Grid control questions

Post by Aracknid » Tue Jun 28, 2011 4:26 pm

It seems I was partially mistaken. There are 2 cases and they behave as follows:

If the entire cell is not in view, EnsureVisible DOES work to show the entire cell.

If the cell is partially visible, then EnsureVisble does nothing. So for example, If it is a cell that is 100 pixels wide by default, and the column has been scrolled to only show a few pixels, then the cells within the column are still partially visible and EnsureVisible does not scroll the entire column into view. Under the covers I can spy on the cell and Ranorex believes it is actually only a few pixels wide. It doesn't realize that it should be 100 pixels. So ScreenLocation values are "what you see". I have no idea if this is a bug or not (perhaps this is how Silverlight's grid reports info to you).

Focus seems to do nothing.

The reason this is an issue for me, is because the cells contain other controls when clicked, like text, combos, date pickers, etc... When I click a partially visible cell, I cannot always see the controls within the cells. The logic (or lack thereof) in my code assumes that if the cell is visible then all items within it are also visible. But even though the cell itself is only as big as "what you see", the controls within it are their actual size, and underneath the frozen columns. So, if I try to click directly on the control within the cell, it seems as though it is trying to click on the center of the control (which happens to be under the frozen column), and clicks on the wrong column. Like for the cells, if the text boxes within the cells are partially visible, EnsureVisible does not move them into view.

I have e-mailed support a snapshot and a screen shot with info in it to try to explain what I'm talking about. In my screen shot I have a green box around the area that I refer to as "what you see" and a purple box around the true actual size of the cell. There is also the Red ranorex highlight of the text control within the cell. This is mostly not actually visible since it is covered by the frozen cell.

I believe I have a work around, which I don't care much for, but it will do if there is no way to make a partially visible cell entirely visible. My work around is to use the tab and arrow keys to navigate the spreadsheet, which forces the cells into full view. This is not great for a large grid with lots of rows...

Thanks,

Aracknid

User avatar
Aracknid
Posts: 342
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: Silverlight Data Grid control questions

Post by Aracknid » Tue Jun 28, 2011 10:40 pm

I need to update this a bit with some more info.

Everything above in the previous post is still true, but it is specific to items scrolled to the left and under the frozen columns. I didn't even notice that it behaves a bit different for items on the right side that are partially in view.

For items on the right side of the table, if they are entirely out of view, they report back as not visible and can be brought into view with EnsureVisible. However, for items that are partially in view on the right side, they report back as visible (and here's the difference with the above) AND they report back that their cell width is the full width, even though you cannot see it all.

I'll send another attachment and with a full snap shot of the table and another screen shot to illustrate.

Aracknid

User avatar
artur_gadomski
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark
Contact:

Re: Silverlight Data Grid control questions

Post by artur_gadomski » Wed Jun 29, 2011 8:09 am

Would making sure next/previous cell is visible help you? If both next and previous cell is visible, even if it's just a few pixels then the cell between them must be fully visible.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Silverlight Data Grid control questions

Post by Support Team » Fri Jul 01, 2011 10:13 am

Hi,
Aracknid wrote:However, for items that are partially in view on the right side, they report back as visible (and here's the difference with the above) AND they report back that their cell width is the full width, even though you cannot see it all.
Sorry about that limitation, we know about this bug and this bug will be fixed with the next Ranorex release. Currently the EnsureVisible method won't work if only one pixel is visible, because the UIAutomation framework return Ranorex that this element is visible and therefore the EnsureVisbile method doesn't work. Ranorex is based on the UIAutomation framework and this framework is not the best. :) In the future we will ship our own WPF Plug-In, where such issues shouldn't occur anymore.

As workaround I would suggest you to take the next element which is not visible and execute EnsureVisbile on this element. Then the element before should be fully shown in your grid.

Regards,
Peter
Ranorex Team
.
Image

User avatar
Aracknid
Posts: 342
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: Silverlight Data Grid control questions

Post by Aracknid » Mon Jul 04, 2011 2:56 pm

Unfortunately, checking the column on the one side or the other will not work for the extreme ends.

For example, when there are frozen columns, if the first 4 columns are frozen in place and the 5th column is the one I want to work with and it is not entirely visible and the 6th column is entirely visible, checking the 4th and 6th colums tells me that they are both visible and thus the assumption that the 5th must be visible would be incorrect. Setting focus to the 4th column (which is frozen) does not make the 5th column visible (the first non-frozen column).

Likewise, if the last column is not entirely visible, checking the second last column doesn't help me know that the last one is entirely visible or not.

As a work around, I put the focus on the first cell and press the TAB key x-1 times (where x is the column I want to work with) which ensures it is visible as it moves the focus from cell to cell.

I'll probably make a hybred function that will only do that for the extreme end columns, and otherwise will ensure visible for the x-1 and x+1 column if it is in the middle, since that will be faster than tabbing.

Thanks,

Aracknid