private static void OnTextFormatChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { LinkedTextBox myLink = d as LinkedTextBox; myLink.updateContents(); }
private static void OnReadLinkChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { LinkedTextBox myLink = d as LinkedTextBox; string newValue = e.NewValue as string; DependencyProperty dp = e.Property; if (dp == ReadLink1Property) { myLink.ReadLink1 = newValue; } else { myLink.ReadLink2 = newValue; } // A read link ID has been updated so search for a write link with that ID and update contents if (!String.IsNullOrWhiteSpace(newValue)) { foreach (LinkedTextBox link in _links) { if ((!String.IsNullOrWhiteSpace(link.WriteLink)) && (link.WriteLink == newValue)) { if (dp == ReadLink1Property) { if (myLink.BoxType == LinkedTextBoxType.Normal) { myLink._linkedContent1 = link.Text; } else { try { myLink._linkedContent1 = Convert.ToInt32(link.Text); myLink.updateContents(); } catch (Exception) { } } } else { if (myLink.BoxType == LinkedTextBoxType.Normal) { myLink._linkedContent2 = link.Text; } else { try { myLink._linkedContent2 = Convert.ToInt32(link.Text); myLink.updateContents(); } catch (Exception) { } } } myLink.updateContents(); break; } } } }