In WPF you can override the OnPropertyChanged event and wait until the
DataContext property comes through in the event args.  You can then
check e.NewValue to see what it's binding to.

 

I'm not sure if Silverlight implements this the same way though.

 

Carl.

 

Carl Scarlett

Senior .NET/WPF Developer, UX Designer - Genesis Team

IT Applications Delivery | Bankwest

A: Level 5, 199 Hay Street | Perth | Western Australia | 6004

P: (08) 9449 8703

M: 0408 913 870

E: carl.scarl...@bankwest.com.au

 

 

 

From: ozsilverlight-boun...@ozsilverlight.com
[mailto:ozsilverlight-boun...@ozsilverlight.com] On Behalf Of
ton...@tpg.com.au
Sent: Monday, 15 February 2010 8:07 AM
To: ozsilverlight@ozsilverlight.com
Subject: How to detect that a control is bound..

 

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 
ozsilverlight@ozsilverlight.com 
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight 

______________________________________________________________________ 
This email has been scanned by the MessageLabs Email Security System. 
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________ 

_______________________________________________________________________________
Unencrypted electronic mail is not secure and may not be authentic.
If you have any doubts as to the contents please telephone to confirm.

This electronic transmission including any attachments is intended only
for those to whom it is addressed. It may contain copyright material or
information that is confidential, privileged or exempt from disclosure by law.
Any claim to privilege is not waived or lost by reason of mistaken transmission
of this information. If you are not the intended recipient you must not
distribute or copy this transmission and should please notify the sender.
Your costs for doing this will be reimbursed by the sender.

We do not accept liability in connection with computer virus, data corruption,
delay, interruption, unauthorised access or unauthorised amendment.
_______________________________________________________________________________


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
_______________________________________________
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight

Reply via email to