public void PopulateWithLinks(IEnumerable <string> source) { Application.Current.Dispatcher.Invoke(() => { foreach (var item in source) { var txt = new TextBlock { Text = item, HorizontalAlignment = System.Windows.HorizontalAlignment.Left }; var evargs = new ElementPopulateEventArgs(item, txt, false); OnInsertingSugerentControl(evargs); if (!evargs.Cancel) { evargs.ControlAdd.MouseDown += (sender, e) => actionClickSearch(txt.Text); stackPanel.Children.Add(evargs.ControlAdd); } } }); }
protected virtual void OnInsertingSugerentControl(ElementPopulateEventArgs evargs) => InsertingSugerentControl?.Invoke(this, evargs);