Windows Vista Forums
Vista Forums Home Join Vista Forums Webcasts Vista Tutorials Tags

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.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

SetWindowRedraw equivalent in WPF?

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 11-09-2006   #1 (permalink)
John Dunn
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 SpecsSystem Spec
Old 11-10-2006   #2 (permalink)
Bob
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 SpecsSystem Spec
Old 11-10-2006   #3 (permalink)
Bob
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 SpecsSystem Spec
Old 11-10-2006   #4 (permalink)
John Dunn
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 SpecsSystem Spec
Old 11-10-2006   #5 (permalink)
John Dunn
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 SpecsSystem Spec
Old 11-10-2006   #6 (permalink)
John Dunn
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 SpecsSystem Spec
Old 11-10-2006   #7 (permalink)
John Dunn
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 SpecsSystem Spec
Old 11-10-2006   #8 (permalink)
Laurent Bugnion
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 SpecsSystem Spec
Old 11-10-2006   #9 (permalink)
Laurent Bugnion
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 SpecsSystem Spec
Closed Thread

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


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51