Visual Studio and .NET Framework Home
WPF LayoutUpdated has sender always null
as By Design
8/17/2007 8:54:30 AM
User(s) can reproduce this bug
Hi, I think the LayoutUpdated does not set the sender parameter.
Visual Studio Code Name "Orcas" (Beta 2)
Operating System Language
Steps to Reproduce
Create a new WPF application.
Attach a LayoutUpdated handler to the root Grid element.
Run the application and check the sender paramater in the handler.
Thre Grid control.
TAP Code (if applicable)
You can indicate your satisfaction with how Microsoft handled this issue by completing this quick
3 question survey
to post a comment.
Please enter a comment.
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.
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.
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.
Visual Studio Product Team.
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).
Visual Studio Product Team
to post a workaround.
Please enter a workaround.
© 2014 Microsoft