Focus Jump

Grids for WPF Forum

Posted 7 years ago by Steve
Version: 12.2.0570
Avatar

Hi, we’ve got a weird problem that has just started happening. In some situations, after the property grid has been refreshed and the scroll bar is present (due to more properties/categories than real estate), we get a weird focus problem. If you scroll down and try and open a collapsed category the grid automatically scrolls back up to the top. If you then scroll back down to the category you were trying to open it hasn’t expanded the category. It doesn’t happen all of the time. Is this something you have seen before? It’s not because the properties are getting refreshed, I checked. 

 

 I know everyone says this but I’d really appreciate it if you could get back to me as soon as you can as we have a major release out next week :-O.

Comments (12)

Posted 7 years ago by Bill Henning (Actipro) - Actipro Software LLC
Avatar

Hi Steve,

Sorry, we're not aware of any issues like that.  If you are able to make a simple sample project that can repro it, please do so and send it to our support address with repro steps, and mention this post.  Be sure to rename the .zip file extension so it doesn't get spam blocked.

Posted 7 years ago by Steve
Avatar

Hi Bill, thanks.  It's getting late over here in the UK but I'll see how I get on tomorrow.  If I can force it so have focus after a rebind then I think it solves the problem (I hope).  We've been using the control for well over a year so something must have changed our end to cause this weird side effect.  I'll keep you posted anyway.  Thanks for the fast response. Steve

Posted 7 years ago by Steve
Avatar

Hi Bill,

I'm pretty sure that previously when the grid was refreshed it used to always start off from the top, so the top most property was always visible.  So for example say the user scrolled down half way to change some properties and then went to select on say another page the Grid would refresh ( due to the source changing ) and the properties would start off from the top again.  I'm not saying here that your grid is as fault, something has changed our end I think.  Is there any way to force the property grid to always start from the top again when the properti source has changed?  It seems if you do a Focus() on the property grid it jumps back to the top but I was wondering if there was another way to do it as Focus seems a bit of a hack.  I hope all this makes sense and thanks again for your help.

Steve

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Steve,

Several releases back we did some updates on the PropertyGrid refresh code.  I wonder if that played into this, assuming that you recently updated from say version 2011.1 or so.  But if you have been using a newer version for a while, I'm not sure that we've changed anything that would cause a difference in focus.

The Focus method call you have is probably a good solution since it should focus the top control in the PropertyGrid.  Or perhaps clear out the SelectedObject property and then restore it.  Perhaps that would reset the scroll too.


Actipro Software Support

Posted 7 years ago by Steve
Avatar

Hi Bill,

 

I'm off now as it's nearly Saturday here (in 5 mins).  I've just created a small video to show you the problem, if I get more time over the weekend I'll try and create a test harness, but as it may be some other issue that's having a side effect with the grid that may be hard to do.  I'll send the video to your support guys, basically you can (just about) see that I scroll down, select a category, the grid jumps up and when you scroll back down again the category hasn't even opened.  The version of the PropertyGrid.WPF is 11.2.552.0

Thanks again for all your help Bill, have a great weekend!

Regards

Steve

Posted 7 years ago by Steve
Avatar

Just a bit more info. As mentioned the issue doesn't happen straight away, not until you've been playing around with the grid for a minute or so.

I added

propgrid:PropertyGridDataAccessorItem.Expanded="propGrid_Expanded" and in the code behind handler it would get called every time you expanded a category (as expected) but as soon as the issue starts, the event handler doesn't get fired, the grid scrolls back to the top (so the first property is shown) and the handler is then only fired when you scroll backdown and reselect the category again (which you can see in the video – which I sent to the support guys – I’ll post the ticket no. here if you need it).

Unfortunately, I think it's one of these issues that would be hard to replicate in an example demo project but if we do manage to do it then we’ll send in a copy.

Regards

 

Steve

Posted 7 years ago by Steve
Avatar

OK a bit more info, it's not random, which I didn't think it would be.  It only happens after you change a property on the grid.  Perhaps something our end is causing issues with the grid due to the property change.  At least I can replicate the issue each time now, always a good thing! :-)

Posted 7 years ago by Steve
Avatar

We inherit from System.ComponentModel.ProeprtyDescriptor and so I unwired the ::SetValue (so no changes happened 'our end') and the problem still occurs. 

On Monday I'll get someone to look at the version that's in Production to see which version of the propertygrid we are using, as apparently it's OK in the current release of our App.

Posted 7 years ago by Steve
Avatar

That was System.ComponentModel.PropertyDescriptor of course, typo.

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Steve,

You could always try and repro it with our own samples and see if it happens there.  That would be helpful if we could see it in those or your own simple sample project.  I'm not sure what could be causing it offhand.


Actipro Software Support

Posted 7 years ago by Steve
Avatar

Hi guys,  OK I think we have a fix.  We have just upgraded to 4.5 and set the new VirtualisingPanel attached property IsVirtualizing to true,

( VirtualizingPanel.IsVirtualizing="True" )  in the Xaml for the PropertyGrid and it seems fix the issue. 

Answer - Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Steve,

Good find... and just for the benefit of anyone reading this thread, the original problem is in Microsoft's TreeView control (which PropertyGrid inherits) and we've been able to repro it with a plain TreeView.  But Steve's findings do seem to resolve it.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.