Reputation: 7440
I would like to know if there is a mechanism to intercept all Bindings, so that I can suppress the updating on a specific condition?
Pseudo Code:
public class Utils
{
public void RegisterInterceptionOfBinding()
{
WpfBindingMechanism.OnSourceUpdating += SourceUpdating;
WpfBindingMechanism.OnTargetUpdating += TargetUpdating;
}
private void SourceUpdating(object sender, SourceUpdatingEventArgs args)
{
if (DoSomeMagicConditionChecking)
{
args.Cancel = true;
}
}
private void TargetUpdating(object sender, SourceUpdatingEventArgs args)
{
if (DoSomeMagicConditionChecking)
{
args.Cancel = true;
}
}
}
I am searching for a mechanism that works on ALL Bindings in the entire WPF Application.
Upvotes: 4
Views: 326
Reputation: 735
You might be looking to use the TypeDescriptionProvider
class.
Here is a forum post on MSDN that might answer your question:
Upvotes: 1