CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2001
    Location
    Kerala,India
    Posts
    650

    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

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Force Refresh WPF Window

    Are you using any sort of MVP, MVC, MVVM architecture?

  3. #3
    Join Date
    Nov 2001
    Location
    Kerala,India
    Posts
    650

    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

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    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).

  5. #5
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Force Refresh WPF Window

    Quote Originally Posted by Arjay View Post
    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).

  6. #6
    Join Date
    Nov 2001
    Location
    Kerala,India
    Posts
    650

    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

  7. #7
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    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
  •  





Click Here to Expand Forum to Full Width

Featured