Hi,
I have a short note on data binding: when source value is updated, the target value is not updated until all dispatcher processes the corresponding binding-related messages in it's message queue (or layout-related messages as well).
But, if this behavir does not suit your scenario, you can use one trick that I foun: you can make binding engine to update all bindings (with shceduled updates) manually. Here is some code to do that:
Assembly asm = Assembly.GetAssembly( typeof( System.Windows.Shapes.Ellipse ) );
string typename = Assembly.CreateQualifiedName( asm.FullName, "MS.Internal.Data.DataBindEngine" );
Type type = Type.GetType( typename );
PropertyInfo prop = type.GetProperty( "CurrentDataBindEngine",
BindingFlags.NonPublic | BindingFlags.Static );
object value = prop.GetValue( null, null );
MethodInfo methodRun = type.GetMethod( "Run",
BindingFlags.Instance | BindingFlags.NonPublic, null,
new Type[] { typeof(object) }, null );
// you can set false - than some bindings can be still left unprocessed
methodRun.Invoke( value, new object[] { true } );
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5