1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Windows;
- using System.Windows.Controls;
- namespace AIPractice.LabellerServer.WPF
- {
- /// <summary>
- /// Interaction logic for MultiSelector.xaml
- /// </summary>
- public partial class MultiSelector : UserControl
- {
- public event EventHandler<bool> SelectUnSelectAll;
- public event EventHandler Refreshed;
- public IEnumerable ItemsSource
- {
- get => SelectorItems.ItemsSource;
- set => SelectorItems.ItemsSource = value;
- }
- public DataTemplate ItemTemplate
- {
- get => SelectorItems.ItemTemplate;
- set => SelectorItems.ItemTemplate = value;
- }
- public string Text
- {
- get => MultiSelectorButton.Content.ToString();
- set => MultiSelectorButton.Content = value;
- }
- public MultiSelector()
- {
- InitializeComponent();
- }
- private void OnShowItemsClick(object sender, RoutedEventArgs e)
- {
- PART_Popup.IsOpen = true;
- }
- private void OnSelectAllChecked(object sender, RoutedEventArgs e)
- {
- OnSelectUnSelectAll(true);
- }
- private void OnSelectAllUnChecked(object sender, RoutedEventArgs e)
- {
- OnSelectUnSelectAll(false);
- }
- private void OnSelectUnSelectAll(bool e)
- {
- SelectUnSelectAll?.Invoke(this, e);
- }
- public void SelectAll()
- {
- SelectAllCheckBox.IsChecked = true;
- OnSelectUnSelectAll(true);
- }
- public void UnSelectAll()
- {
- SelectAllCheckBox.IsChecked = false;
- OnSelectUnSelectAll(false);
- }
- private void OnRefreshClick(object sender, RoutedEventArgs e)
- {
- OnRefreshed();
- }
- private void OnRefreshed()
- {
- Refreshed?.Invoke(this, EventArgs.Empty);
- }
- }
- }
|