diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.SharedUI/Controls/MultiSelectListBox.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.SharedUI/Controls/MultiSelectListBox.cs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/MultiSelectListBox.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/MultiSelectListBox.cs new file mode 100644 index 000000000..ca45540fa --- /dev/null +++ b/Software/Visual_Studio/Tango.SharedUI/Controls/MultiSelectListBox.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; + +namespace Tango.SharedUI.Controls +{ + public class MultiSelectListBox : ListBox + { + public IList SelectedItemsList + { + get { return (IList)GetValue(SelectedItemsListProperty); } + set { SetValue(SelectedItemsListProperty, value); } + } + + public static readonly DependencyProperty SelectedItemsListProperty = + DependencyProperty.Register(nameof(SelectedItemsList), typeof(IList), typeof(MultiSelectListBox), new PropertyMetadata(null)); + + public MultiSelectListBox() { } + + protected override void OnSelectionChanged(SelectionChangedEventArgs e) + { + base.OnSelectionChanged(e); + + SelectedItemsList.Clear(); + + foreach (var item in SelectedItems) + { + SelectedItemsList.Add(item); + } + } + } +} |
