-
July 14th, 2010, 12:52 AM
#1
Force Refresh WPF Window
Hi all, I am working with a WPF application. My application contains a re-sizable docked window and floating windows containing user controls representing different pages. Now what i want is when the user re-sizes the dock-able window width i need to reset the width of other windows and make them redraw based on the new width. How can i forcefully redraw the windows to re-arrange its controls based on the new width.
Do rate this post if it find useful to you
-
July 14th, 2010, 01:29 AM
#2
Re: Force Refresh WPF Window
Are you using any sort of MVP, MVC, MVVM architecture?
-
July 14th, 2010, 04:08 AM
#3
Re: Force Refresh WPF Window
Yes we are following the MVP pattern. We are getting the event to redraw the floating windows and there we are calling the InvalidateVisual function of the window. But the window did not getting refreshed nor its OnRender override getting called.
Do rate this post if it find useful to you
-
July 14th, 2010, 07:31 PM
#4
Re: Force Refresh WPF Window
Are you exposing any size or resize dependency properties? If the controls already expose resize dependency properties, are you coercing them?
In other words all controls that need to resize need to be connected up to the VM (in the mvvm pattern). One control initiates the resize, and the VM passes the appropriate values to via a dependencie prop to resize itself (or it's child controls).
-
July 14th, 2010, 07:34 PM
#5
Re: Force Refresh WPF Window
Originally Posted by Arjay
Are you exposing any size or resize dependency properties? If the controls already expose resize dependency properties, are you coercing them?
In other words all controls that need to resize need to be connected up to the VM (in the mvvm pattern). One control initiates the resize, and the VM passes the appropriate values to via a dependencie prop to resize itself (or it's child controls).
I might be misunderstanding the problem, but it doesn't seem like a 'refresh' problem per se - it seems more like the initiating control isn't passing the resize to the VM and/or the controls connected to the VM aren't responding (or don't have the wiring to do so).
-
July 15th, 2010, 12:30 AM
#6
Re: Force Refresh WPF Window
I have added a width dependency property in the windows class and its set with
Code:
System.Windows.FrameworkPropertyMetadataOptions.AffectsRender | System.Windows.FrameworkPropertyMetadataOptions.AffectsArrange
But and then from the main window where i get the width change event of docked windows i will set the new width to with dependency property of all windows. but its not making the window get adjusted or redraw with the new width. what can i do in this.
Do rate this post if it find useful to you
-
July 15th, 2010, 08:28 PM
#7
Re: Force Refresh WPF Window
There's not much I can tell you other than set some breakpoints and step through the code to figure out what is getting called or not getting called or if a component is not reacting to a size change. There's little more I can to to offer from the one line of code you've shown.
If you can create a sample project that shows the issue, zip it up and attached it here, I would be glad to take another look at it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|