WPF刷新界面相关方法

WPF刷新界面的应用技巧是一个非常常用的功能。在实际操作中我们需要对其进行非常熟练的操作。希望这篇文章总介绍的内容可以帮助大家提高对WPF的理解程度。#t#

WPF刷新界面应用代码示例:

  1. /// <summary> 
  2. /// App.xaml 的交互逻辑  
  3. /// </summary> 
  4. public partial class App : Application  
  5. {  
  6. private static DispatcherOperat
    ionCallback 
    exitFrameCallback = 
    new DispatcherOperationCallback(ExitFrame);  
  7. public static void DoEvents()  
  8. {  
  9. DispatcherFrame nestedFrame = 
    new DispatcherFrame();  
  10. DispatcherOperation exitOperation = 
    Dispatcher.CurrentDispatcher.BeginInvoke
    (DispatcherPriority.Background, 
    exitFrameCallback, nestedFrame);  
  11. Dispatcher.PushFrame(nestedFrame);  
  12. if (exitOperation.Status != 
    DispatcherOperationStatus.Completed)  
  13. {  
  14. exitOperation.Abort();  
  15. }  
  16. }  
  17. private static Object ExitFrame
    (Object state)  
  18. {  
  19. DispatcherFrame frame = state as 
    DispatcherFrame;  
  20. frame.Continue = false;  
  21. return null;  
  22. }  

WPF刷新界面使用方法就介绍到这里。

THE END