// clear the code hashset as it will need to be initialized private static void ItemsSourcePropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { IEnumerable source = e.NewValue as IEnumerable; EditSelector control = sender as EditSelector; if (source == null || control == null) { return; } control.codes = null; control.codesDict = null; }
// initialize the delimiter data structures private static void DelimiterPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { EditSelector control = sender as EditSelector; if (e.NewValue == null || control == null) { return; } // used in Split control.delimiters = new char[] { (char)e.NewValue }; // used to recreate the delimited text (offset by space for readability) control.delimiterString = (char)e.NewValue + " "; }
private static void SelectedItemsPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { IList source = e.NewValue as IList; EditSelector control = sender as EditSelector; if (source == null || control == null) { return; } control.EditTextBox.TextChanged -= control.EditTextBox_TextChanged; control.ConvertSelectedItemstoText(); control.EditTextBox.TextChanged += control.EditTextBox_TextChanged; }
// clear the codes hashset private static void CodeMemberPathPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { string source = e.NewValue as string; string old = e.OldValue as string; EditSelector control = sender as EditSelector; if (source == null || control == null) { return; } // clear the hashset as the data structure will need to be initialized control.codes = null; control.codesDict = null; }
// initialize the plus button access key private static void PlusButtonAccessKeyPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { string source = e.NewValue as string; string old = e.OldValue as string; EditSelector control = sender as EditSelector; if (source == null || control == null) { return; } // set the access key for the plus button AccessKeyManager.Register(source, control.PlusButton); // unregister the old access key if present if (old != null) { AccessKeyManager.Unregister(old, control.PlusButton); } }