private FrameworkElement CreateBindableMultipleSelectControl(PropertyItem pi, string lookupKey) { var control = new ListBoxWrapper(); var data = pi.Converter.Convert(pi.ItemsSource, typeof(IList <string>), null, null) as IList <string>; control.AllItems = data; control.InitSelectedItemsViewModel = null; ReferenceLookupList.RegisterListUpdateEventHandler(lookupKey, (sender, args) => { var list = ReferenceLookupList.GetCompleteList(lookupKey); var data1 = pi.Converter.Convert(list, typeof(IList <string>), null, null) as IList <string>; control.AllItems = data1; }); var selectedItemBinding = pi.CreateBinding(); selectedItemBinding.Mode = BindingMode.TwoWay; control.SetBinding(ListBoxWrapper.SelectedItemsProperty, selectedItemBinding); //var initSelectedBinding = pi.CreateOneWayBinding(); //control.SetBinding(ListBoxWrapper.InitSelectedItemsProperty, initSelectedBinding); return(control); //return base.CreateDefaultControl(pi); }
private int autoScrollSpeed = 25; // char per second public MainWindow() { InitializeComponent(); editor = new Reader(ParagraphListBox); sidebar = new Sidebar(HeaderListBox); headerListBoxHandler = new HeaderListBoxKeyHandler(sidebar, editor); paragraphListBoxHandler = new ParagraphListBoxKeyHandler(editor, sidebar); autoScrollTimer.AutoReset = true; autoScrollTimer.Interval = 1000; autoScrollTimer.Elapsed += autoScrollTimer_Elapsed; LoadLastFile(); }
static void Main() { Form f = new Form(); ListBox b0 = new ListBoxWrapper(); ListBox b1 = new ListBoxWrapper(); b0.DataSource = list; b1.DataSource = list; Button b2 = new Button(); b2.Click += new EventHandler(HandleClick); f.Controls.Add(b0); f.Controls.Add(b1); f.Controls.Add(b2); b1.Location = new Point(0, b0.Height); b2.Location = new Point(0, b1.Location.Y + b1.Height); Application.Run(f); }
public KeyHandler(ListBoxWrapper e) { this.Element = e; }
public HeaderListBoxKeyHandler(ListBoxWrapper headers, ListBoxWrapper paragraphs) : base(headers) { this.Paragraphs = paragraphs; }
public ParagraphListBoxKeyHandler(ListBoxWrapper paragraphs, ListBoxWrapper headers) : base(paragraphs) { this.Headers = headers; }