Beispiel #1
0
        protected override void OnKeyDown(System.Windows.Input.KeyEventArgs e)
        {
            if (ParentTreeListView != null)
            {
                ParentTreeListView.SelectSource = SelectionSource.Keyboard;
            }
            bool wasSelected = IsSelected;

            base.OnKeyDown(e);
            if (wasSelected && !IsSelected)
            {
                if (SupportsMultiSelect && IsShiftPressed)
                {
                    IsMultiSelected = true;
                }
                else
                {
                    ParentTreeListView.CleanupMultiSelects();
                }
            }
            if (ParentTreeListView != null)
            {
                ParentTreeListView.SelectSource = SelectionSource.Unknown;
            }
        }
Beispiel #2
0
        protected override void OnMouseLeftButtonDown(System.Windows.Input.MouseButtonEventArgs e)
        {
            bool wasMultiSelected = IsMultiSelected;
            bool multiSelect      = SupportsMultiSelect && (IsShiftPressed || IsCtrlPressed) && ParentTreeListView != null;

            if (multiSelect)
            {
                ParentTreeListView.BeginMultiSelect();
            }
            if (ParentTreeListView != null)
            {
                ParentTreeListView.SelectSource = SelectionSource.Mouse;
            }
            base.OnMouseLeftButtonDown(e);
            if (multiSelect)
            {
                if (IsShiftPressed)
                {
                    ParentTreeListView.MultiSelectTo(this);
                }
                ParentTreeListView.EndMultiSelect();
            }
            if (!multiSelect && !wasMultiSelected)
            {
                ParentTreeListView.CleanupMultiSelects();
            }
            if (ParentTreeListView != null)
            {
                ParentTreeListView.SelectSource = SelectionSource.Unknown;
            }
        }
Beispiel #3
0
 protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
 {
     base.OnMouseLeftButtonUp(e);
     if (!IsShiftPressed && !IsCtrlPressed && ParentTreeListView != null)
     {
         ParentTreeListView.CleanupMultiSelects();
     }
 }
Beispiel #4
0
 protected override void OnUnselected(RoutedEventArgs e)
 {
     if (ParentTreeListView == null || (!ParentTreeListView.InMultiSelect && ParentTreeListView.SelectSource != SelectionSource.Mouse))
     {
         IsMultiSelected = false;
     }
     base.OnUnselected(e);
     if (ParentTreeListView != null && ParentTreeListView.SelectSource == SelectionSource.Unknown)
     {
         ParentTreeListView.CleanupMultiSelects();
     }
 }