![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | SetWindowRedraw equivalent in WPF? Is there a way to temporarily stop updates when adding a large number of visual objects to a Canvas? On certain event I'm programatically adding a bunch of DrawingVisuals to my Canvas and I think it would make sense to stop the Canvas from updating the view until I'm done. Not only would it probably be faster but right now the graphics randomly pop into view which I think would be disconcerting to the user. I have a custom implementation of VisualChildren ( overriding VisualChildrenCount and GetVisualChild ) if that matters. In Win32 you could call SetWindowRedraw when adding a bunch of items to a control ( ListView, TreeView, etc ) to help with performance issues. Is there something similar in WPF? I looked through the SDK and didn't see anything obvious. Thanks- John |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: SetWindowRedraw equivalent in WPF? In article <OdoFIACBHHA.3316@TK2MSFTNGP02.phx.gbl>, jhndnn@community.nospam says... > Is there a way to temporarily stop updates when adding a large number of > visual objects to a Canvas? On certain event I'm programatically > adding a bunch of DrawingVisuals to my Canvas and I think it would make > sense to stop the Canvas from updating the view until I'm done. Not only > would it probably be faster but right now the graphics randomly pop into > view which I think would be disconcerting to the user. > > I have a custom implementation of VisualChildren ( overriding > VisualChildrenCount and GetVisualChild ) if that matters. > > In Win32 you could call SetWindowRedraw when adding a bunch of items to > a control ( ListView, TreeView, etc ) to help with performance issues. > Is there something similar in WPF? I looked through the SDK and didn't > see anything obvious. > > Thanks- > > John > John, Have a look at FrameworkContentElement.BeginInit and EndInit methods. |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: SetWindowRedraw equivalent in WPF? In article <OdoFIACBHHA.3316@TK2MSFTNGP02.phx.gbl>, jhndnn@community.nospam says... > Is there a way to temporarily stop updates when adding a large number of > visual objects to a Canvas? On certain event I'm programatically > adding a bunch of DrawingVisuals to my Canvas and I think it would make > sense to stop the Canvas from updating the view until I'm done. Not only > would it probably be faster but right now the graphics randomly pop into > view which I think would be disconcerting to the user. > > I have a custom implementation of VisualChildren ( overriding > VisualChildrenCount and GetVisualChild ) if that matters. > > In Win32 you could call SetWindowRedraw when adding a bunch of items to > a control ( ListView, TreeView, etc ) to help with performance issues. > Is there something similar in WPF? I looked through the SDK and didn't > see anything obvious. > > Thanks- > > John > John, Have a look at FrameworkContentElement.BeginInit and EndInit methods. |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: SetWindowRedraw equivalent in WPF? Bob wrote: > In article <OdoFIACBHHA.3316@TK2MSFTNGP02.phx.gbl>, > > John, > Have a look at FrameworkContentElement.BeginInit and EndInit methods. Bob- Thanks for the reply. Unless I'm misreading the documentation, that doesn't look like what I need. From reading the SDK it sounds like BeginInit/EndInit are called during the initialization stage of a FrameworkContentElement. I assume that would be the place to add a bunch of children while my panel was initializing. The problem is that I'm adding content at runtime, not during initialization. My canvas is already created and visible with some content, and the user will come along and do something that will cause more or less content to appear. Ideally I'd like something like this // stop the canvas from redrawing when children are addedcanvas->LockUpdates(); // // add a bunch of children to the canvas // // allow the canvas to process updated children canvas->UnLockUpdates(); Thanks- John |
My System Specs![]() |
| | #5 (permalink) |
| Guest | Re: SetWindowRedraw equivalent in WPF? Bob wrote: > In article <OdoFIACBHHA.3316@TK2MSFTNGP02.phx.gbl>, > > John, > Have a look at FrameworkContentElement.BeginInit and EndInit methods. Bob- Thanks for the reply. Unless I'm misreading the documentation, that doesn't look like what I need. From reading the SDK it sounds like BeginInit/EndInit are called during the initialization stage of a FrameworkContentElement. I assume that would be the place to add a bunch of children while my panel was initializing. The problem is that I'm adding content at runtime, not during initialization. My canvas is already created and visible with some content, and the user will come along and do something that will cause more or less content to appear. Ideally I'd like something like this // stop the canvas from redrawing when children are addedcanvas->LockUpdates(); // // add a bunch of children to the canvas // // allow the canvas to process updated children canvas->UnLockUpdates(); Thanks- John |
My System Specs![]() |
| | #6 (permalink) |
| Guest | Re: SetWindowRedraw equivalent in WPF? Let my repost that pseudo code since it looks like Thunderbird decided to format it for me. // stop the canvas from redrawing when children are addedcanvas->LockUpdates(); // // add a bunch of children to the canvas // // allow the canvas to process updated children canvas->UnLockUpdates(); |
My System Specs![]() |
| | #7 (permalink) |
| Guest | Re: SetWindowRedraw equivalent in WPF? Let my repost that pseudo code since it looks like Thunderbird decided to format it for me. // stop the canvas from redrawing when children are addedcanvas->LockUpdates(); // // add a bunch of children to the canvas // // allow the canvas to process updated children canvas->UnLockUpdates(); |
My System Specs![]() |
| | #8 (permalink) |
| Guest | Re: SetWindowRedraw equivalent in WPF? Hi, John Dunn wrote: > Thanks for the reply. Unless I'm misreading the documentation, that > doesn't look like what I need. From reading the SDK it sounds like > BeginInit/EndInit are called during the initialization stage of a > FrameworkContentElement. I assume that would be the place to add a bunch > of children while my panel was initializing. > > The problem is that I'm adding content at runtime, not during > initialization. My canvas is already created and visible with some > content, and the user will come along and do something that will cause > more or less content to appear. Ideally I'd like something like this > > // stop the canvas from redrawing when children are > addedcanvas->LockUpdates(); > // > // add a bunch of children to the canvas > // > // allow the canvas to process updated children > canvas->UnLockUpdates(); > > Thanks- > > John The names are terrible, and the documentation is not clear, but from all the examples I saw so far, I think that BeginInit and EndInit are actually exactly doing that: Blocking the update on a FrameworkContentElement temporarily, while you add stuff to it. After EndInit is called, the framework will redraw the element. Greetings, Laurent -- Laurent Bugnion, GalaSoft Software engineering: http://www.galasoft-LB.ch Private/Malaysia: http://mypage.bluewin.ch/lbugnion Support children in Calcutta: http://www.calcutta-espoir.ch |
My System Specs![]() |
| | #9 (permalink) |
| Guest | Re: SetWindowRedraw equivalent in WPF? Hi, John Dunn wrote: > Thanks for the reply. Unless I'm misreading the documentation, that > doesn't look like what I need. From reading the SDK it sounds like > BeginInit/EndInit are called during the initialization stage of a > FrameworkContentElement. I assume that would be the place to add a bunch > of children while my panel was initializing. > > The problem is that I'm adding content at runtime, not during > initialization. My canvas is already created and visible with some > content, and the user will come along and do something that will cause > more or less content to appear. Ideally I'd like something like this > > // stop the canvas from redrawing when children are > addedcanvas->LockUpdates(); > // > // add a bunch of children to the canvas > // > // allow the canvas to process updated children > canvas->UnLockUpdates(); > > Thanks- > > John The names are terrible, and the documentation is not clear, but from all the examples I saw so far, I think that BeginInit and EndInit are actually exactly doing that: Blocking the update on a FrameworkContentElement temporarily, while you add stuff to it. After EndInit is called, the framework will redraw the element. Greetings, Laurent -- Laurent Bugnion, GalaSoft Software engineering: http://www.galasoft-LB.ch Private/Malaysia: http://mypage.bluewin.ch/lbugnion Support children in Calcutta: http://www.calcutta-espoir.ch |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| VB6 Equivalent | Phil Hunt | .NET General | 5 | 05-22-2008 04:22 PM |
| 'runwait' equivalent | Cookiecutter | PowerShell | 4 | 04-09-2008 09:34 PM |
| right-click equivalent | Frustrated | Vista hardware & devices | 3 | 01-20-2008 10:00 PM |
| Equivalent to $0? | Charlie Russel - MVP | PowerShell | 10 | 06-12-2007 12:51 AM |
| what is the equivalent of xp pro | Lamb Chop | Vista General | 13 | 02-09-2007 09:15 PM |