public static void SetSuggest(DependencyObject obj, string handler) { obj.SetValue(Suggest, handler); EventSupport.AttachEvent(obj, handler, new Type[] { typeof(string), typeof(SuggestCallback) }, (sender, target, info) => { Autocomplete autocomplete = new Autocomplete(sender as TextBox); autocomplete.SuggestHandler = (text, callback) => { info.Invoke(target, new object[] { text, callback }); }; }); }