Example #1
0
        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);
                    }
                }
            });
        }
Example #2
0
 protected virtual void OnInsertingSugerentControl(ElementPopulateEventArgs evargs) => InsertingSugerentControl?.Invoke(this, evargs);