/// <summary> /// Constructor for a generic listbox winodow for selection of Eclispe data objects /// </summary> /// <param name="title"></param> /// <param name="label"></param> /// <param name="selectionmode"></param> /// <param name="vobjs"></param> public ListBoxWindow(string title, string label, System.Windows.Controls.SelectionMode selectionmode, ViewType type, IEnumerable <v.ApiDataObject> vobjs) { InitializeComponent(); this.Title = title; _vm = new ESAPISimpleUI.ViewModel.ListViewModel(); _vm.CreateList(vobjs); _vm.Label = label; _vm.ListBoxSelectionMode = selectionmode; UserControl view; if (type == ViewType.ListBox) { view = new ESAPISimpleUI.View.GenericListView(); } else { view = new ESAPISimpleUI.View.GenericDataGridView(); } view.DataContext = _vm; this.gridRow0.Children.Add(view); }
protected virtual void OnSelectionModeChanged(DependencyPropertyChangedEventArgs e) { System.Windows.Controls.SelectionMode oldMode = (System.Windows.Controls.SelectionMode)e.OldValue; object lastSelected = SelectedItem; if (oldMode == System.Windows.Controls.SelectionMode.Multiple) { UnselectAll(); if (lastSelected != null) { SelectedItems.Add(lastSelected); } } }