The dispatcher has several priorities for processing the single tasks. I'm quite sure you cannot change the priority of the callbacks of dependency properties. If they were changed by data binding, they will be in queue with DispatcherPriority.DataBinding priority.
You manipulate the values of some dependency properties which would cause layout/other dependency properties to change. And you want to wait after your first manipulation until these layout updates/changes are processed and then do something with the current UI state?
WinForms had the DoEvents function for such cases which causes all UI events being processed before normal code execution continues. WPF has no such builtin function but you can write your own DoEvents:
public static void DoEvents()
{
if (Application.Current == null)
return;
Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, (Delegate) (() => {}));
}
The empty delegate is invoked synchronously, that means the call returns after the delegate was executed by the dispatcher. The DispatcherPriority.Background is a very low priority so that this dispatcher call is processed after for example data bindings, layout updates or rendering.
http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcherpriority.aspx
So call DoEvents() after your first manipulation of the dependency properties and before you want to read other dependency properties and it should be done.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…