c# - WPF TabControl tab changes not refreshed -
I have I hope to refresh the UI and go from What is The code runs on the UI thread by default, so the thread can not be executed on the UI thread (such as layout) until the thread is executed. There are several ways to issue control of the UI thread before the code is over, but I think the code can be used to run from the use of a For example, It should be noted that UI objects can only be modified on the UI thread, so if your "other code here" updates a UI object, then you might execute it Would like to use code on the UI thread, such as: WPF TabControl with two
TabItems . I am trying to change the event and execute some other code by clicking the selected tab on the code behind the code on the
button . In this example:
Private Wide Buttonic (Object Sender, Routing Avent, ARGS E) {ConvertDataTab Control. Select Index = 1; System.Threading.Thread.Sleep (2000); ...}
tab 0 to
tab 1 and then only The sleep method must be executed, but UI is only refreshing after finishing the
Button_Click execution. I tried to call
InvalidVisual , but it does not work.
Sleep
task It's simple to do on a different thread.
Tasks. Factor Start New (() => {Thread.Sleep (2000); // Other code here}};
Dispatcher.BijinWolk ((=) = & gt; {/ code to update III});
Comments
Post a Comment