WPF刷新界面相關(guān)方法
作者:佚名
WPF刷新界面對(duì)于初學(xué)者來說是比較難掌握的一個(gè)知識(shí)。在這里我們將會(huì)以一個(gè)代碼范例來為大家詳細(xì)介紹相關(guān)使用方法。
WPF刷新界面的應(yīng)用技巧是一個(gè)非常常用的功能。在實(shí)際操作中我們需要對(duì)其進(jìn)行非常熟練的操作。希望這篇文章總介紹的內(nèi)容可以幫助大家提高對(duì)WPF的理解程度。#t#
WPF刷新界面應(yīng)用代碼示例:
- /// <summary>
- /// App.xaml 的交互邏輯
- /// </summary>
- public partial class App : Application
- {
- private static DispatcherOperat
ionCallback exitFrameCallback =
new DispatcherOperationCallback(ExitFrame); - public static void DoEvents()
- {
- DispatcherFrame nestedFrame =
new DispatcherFrame(); - DispatcherOperation exitOperation =
Dispatcher.CurrentDispatcher.BeginInvoke
(DispatcherPriority.Background,
exitFrameCallback, nestedFrame); - Dispatcher.PushFrame(nestedFrame);
- if (exitOperation.Status !=
DispatcherOperationStatus.Completed) - {
- exitOperation.Abort();
- }
- }
- private static Object ExitFrame
(Object state) - {
- DispatcherFrame frame = state as
DispatcherFrame; - frame.Continue = false;
- return null;
- }
- }
WPF刷新界面使用方法就介紹到這里。
責(zé)任編輯:曹凱
來源:
博客園