I have a 3rd party control that is quite complex and takes some time to load- when it does there is a 'Ready' event 开发者_JS百科that I can catch to know when its good to go.
I have a ViewModel that is injected via Unity and assigned to the Content of a custom control which is targeted by a DataTemplate containing my 3rd party control.
What I am trying to do is set a property on the 3rd party control from the VM, but only AFTER it is 'Ready'. The bindings are all good, but they are evaluated BEFORE the 3rd party control is ready.
In the codebehind, I can use a delegate to handle the Ready event and set this property manually from the VM, but I really (really) don't want to do this.
Anyone have any ideas? Does this even make sense? :P
Is there any problem if the binding is evaluated earlier? If not i'd just leave the bindings at their current settings and update them again if the control is ready.
e.g.
customControl.GetBindingExpression(CustomControl.CustomProperty).UpdateTarget();
(written from memory but it should be something like that)
精彩评论