private static void setText(DependencyObject d, DependencyPropertyChangedEventArgs e) { ContactControl control = d as ContactControl; if (control != null) { control.nameTextBlock.Text = (e.NewValue as Contact).name; control.emailTextBlock.Text = (e.NewValue as Contact).email; control.phoneNumberTextBlock.Text = (e.NewValue as Contact).phoneNumber; } }
private static void SetText(DependencyObject d, DependencyPropertyChangedEventArgs e) { ContactControl control = d as ContactControl; //check if our control object was created successfully if (control != null) { //set each text block to the values for the object control.nameTextBlock.Text = (e.NewValue as Contact).name; control.emailTextBlock.Text = (e.NewValue as Contact).email; control.phoneNumberTextBlock.Text = (e.NewValue as Contact).phoneNumber; } }