Hi Tony,

You can put a method on your ViewModel, and then in the Loaded event on your
control in the View, call your viewmodel method. Your ViewModel should exist
by that stage (assuming you are hooking up the ViewModel in the construction
stage of your view).

HTH,
Stephen

On Mon, Feb 15, 2010 at 8:07 AM, <[email protected]> wrote:

> Hi all,
>
> I need to attach an event to a ViewModel object that is bound to a control
> via DataContext. The
> problem is, I can't attach the event in the constructor because the
> DataContext object has not
> been set at that point. So how do I attach that event if I want it to
> execute code within the control?
> I can't seem to see an OnDataContextChanged event, or anything like that.
> Does anyone know
> what I am supposed to do here?
>
> Regards,
> Tony
>
> _______________________________________________
> ozsilverlight mailing list
> [email protected]
> http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
>
_______________________________________________
ozsilverlight mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight

Reply via email to