![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| | #2 (permalink) |
| | 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 Specs![]() |
| | #3 (permalink) |
| | 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 Specs![]() |
| | #4 (permalink) |
| | 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 Specs![]() |
| 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 | |||