Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - statusbar textblock update in long running operation

 
 
Old 07-23-2007   #1 (permalink)
Scott Walters


 
 

statusbar textblock update in long running operation

I have a status bar on my window that contains a TextBlock. I am trying
to update the text in the textblock during a long operation that's
running inside a button click handler on the same window. The text
doesn't update until the end, which is not what I want. I've tried
several combinations of InvalidateArrange(), InvalidateVisual() and
UpdateLayout() on both the TextBlock and it's parent StatusBar without
success. How can I do this?

Thanks,
Scott

My System SpecsSystem Spec
Old 07-23-2007   #2 (permalink)
Radek Cerny


 
 

Re: statusbar textblock update in long running operation

It needs to be on a different thread - best way is probably to spawn a new
thread on button click. Plenty of examples around.

"Scott Walters" <scottw512@hotmail.com> wrote in message
news:O1CkIyUzHHA.3400@TK2MSFTNGP03.phx.gbl...
>I have a status bar on my window that contains a TextBlock. I am trying to
>update the text in the textblock during a long operation that's running
>inside a button click handler on the same window. The text doesn't update
>until the end, which is not what I want. I've tried several combinations of
>InvalidateArrange(), InvalidateVisual() and UpdateLayout() on both the
>TextBlock and it's parent StatusBar without success. How can I do this?
>
> Thanks,
> Scott



My System SpecsSystem Spec
Old 07-26-2007   #3 (permalink)
Scott Walters


 
 

Re: statusbar textblock update in long running operation

Are you saying the long running operation should run in a second thread
with a sync context so it can update the status bar ui on it's thread?

If there's no other way, I guess that's what I have to do...but it seems
like I should be able to call into the framework from the UI thread and
tell it to refresh/repaint the status bar contents.

Radek Cerny wrote:
> It needs to be on a different thread - best way is probably to spawn a new
> thread on button click. Plenty of examples around.
>
> "Scott Walters" <scottw512@hotmail.com> wrote in message
> news:O1CkIyUzHHA.3400@TK2MSFTNGP03.phx.gbl...
>> I have a status bar on my window that contains a TextBlock. I am trying to
>> update the text in the textblock during a long operation that's running
>> inside a button click handler on the same window. The text doesn't update
>> until the end, which is not what I want. I've tried several combinations of
>> InvalidateArrange(), InvalidateVisual() and UpdateLayout() on both the
>> TextBlock and it's parent StatusBar without success. How can I do this?
>>
>> Thanks,
>> Scott

>
>

My System SpecsSystem Spec
Old 07-26-2007   #4 (permalink)
Radek Cerny


 
 

Re: statusbar textblock update in long running operation

Its actually internally very complex, but externally simple, and the simple
answer is no. If the UI thread is busy, nothing will redraw.

"Scott Walters" <scottw512@hotmail.com> wrote in message
news:OOb$oA4zHHA.5160@TK2MSFTNGP05.phx.gbl...
> Are you saying the long running operation should run in a second thread
> with a sync context so it can update the status bar ui on it's thread?
>
> If there's no other way, I guess that's what I have to do...but it seems
> like I should be able to call into the framework from the UI thread and
> tell it to refresh/repaint the status bar contents.
>
> Radek Cerny wrote:
>> It needs to be on a different thread - best way is probably to spawn a
>> new thread on button click. Plenty of examples around.
>>
>> "Scott Walters" <scottw512@hotmail.com> wrote in message
>> news:O1CkIyUzHHA.3400@TK2MSFTNGP03.phx.gbl...
>>> I have a status bar on my window that contains a TextBlock. I am trying
>>> to update the text in the textblock during a long operation that's
>>> running inside a button click handler on the same window. The text
>>> doesn't update until the end, which is not what I want. I've tried
>>> several combinations of InvalidateArrange(), InvalidateVisual() and
>>> UpdateLayout() on both the TextBlock and it's parent StatusBar without
>>> success. How can I do this?
>>>
>>> Thanks,
>>> Scott

>>


My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Problems running slow after update, IE but expecially running any Vista music pictures video
Long Vista Load Times normal operation in vista General Discussion
Running C# (.NET Framework 2.0) Application from long path (>127)crashes! .NET General
Running disk defragmenter again still takes long Vista performance & maintenance


Vista Forums 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 Ltd

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