I wish to copy a binding, this is so i can set a different source property on it without affecting the original binding. Is this just a case of setting all of the properties on the new binding to be the same as the old?
A:
You may be able to do something like the following (untested). If this is problematic I'd just create a new Binding and use BindingOperations.SetBinding
.
Binding binding = BindingOperations.GetBinding(target, dp);
binding.Source = yourSource;
-- or --
BindingOperations.SetBinding(target, dp, binding);
Taylor Leese
2009-12-16 01:23:29
A:
if you can't find a method to do this already create an exetension for Binding.
public static class BindingExtensions
{
public static Binding Clone(this Binding binding)
{
var cloned = new Binding();
//copy properties here
return cloned;
}
}
public void doWork()
{
Binding b= new Binding();
Binding nb = b.Clone();
}
runrunraygun
2009-12-16 09:59:41
i guess i just have to copy those properties manually then...
Aran Mulholland
2010-01-13 00:43:55