Home Dashboard Directory Help
Search

WPF LayoutUpdated has sender always null by Jan Kučera


Status: 

Closed
 as By Design Help for as By Design


3
0
Sign in
to vote
Type: Bug
ID: 293803
Opened: 8/17/2007 8:54:30 AM
Access Restriction: Public
0
Workaround(s)
view
2
User(s) can reproduce this bug

Description

Hi, I think the LayoutUpdated does not set the sender parameter.
Details
Sign in to post a comment.
Posted by Microsoft on 9/5/2008 at 3:43 PM
This is by design. The LayoutUpdated event is a per dispatcher event, meaning that it will fire whenever any element in the queue had a layout update. So an update on some element’s layout will cause other elements’ LayoutUpdated events to be also called. We think that LayoutUpdated may not be the event you want to use. Did you try SizeChanged event to do the job?
The SizeChanged event is an "instance event" that is raised whenever the size of the element you have attached the handler to has changed.
NOTE: If the position of the element on the screen changes, but not its size, this event does not get raised.
The LayoutUpdated event is a "static event" that is fired every time layout has been updated anywhere in the element tree, not just the element you have attached the handler to.

You might also want to look at this article on http://blogs.msdn.com/devdave/archive/2008/05/27/layout-events-sizechanged-and-layoutupdated.aspx. It’s related to Silverlight, but the explanation applies well to the WPF case.

Kindly clarify the feature you are trying to implement.
Posted by apolak on 10/8/2007 at 4:14 PM
This bug renders the LayoutUpdated event useless in most scenarios. Hope it's going to be fixed sometime soon.
Posted by Microsoft on 8/19/2007 at 10:42 PM
Thanks for your feedback. We have reproduced this bug on Visual Studio 2008 Beta 2, and we are sending this bug to the appropriate group within the VisualStudio Product Team for triage and resolution.

Thank you,
Visual Studio Product Team.
Posted by Microsoft on 8/19/2007 at 5:15 PM
Thank you for your feedback. We are currently investigating. If this issue is urgent, please call support directly (see http://support.microsoft.com).

Thank you,
Visual Studio Product Team
Sign in to post a workaround.