Trapping a post data binding event for Silverlight
I have a series of controls that are created at run-time and then added to my Silverlight application layout grid. I was wondering if there was some sort of e开发者_JS百科vent that I could trap AFTER data binding has occurred. I would like to do some post processing on the controls after data has been bounded from the DataContext
.
I have implemented INotifyPropertyChanged
, but that only gives me access to the properties of my model upon change, but I would rather have access to the individual user-control object.
Any ideas or suggestions?
As of right now the only event fired that I can see post binding would be the control's Loaded
event. So currently I just do my post processing when this event is trapped.
If anyone else has any better suggestions I am all ears.
TextBox text = (TextBox)uiElement;
text.Loaded += new RoutedEventHandler(TextBox_Loaded);
private void TextBox_Loaded(object sender, RoutedEventArgs e)
{
TextBox textBox = (TextBox)sender;
// do more post processing...
}
精彩评论