static void Fe_PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            SelectableDesignerItemViewModelBase selectableDesignerItemViewModelBase =
                (SelectableDesignerItemViewModelBase)((FrameworkElement)sender).DataContext;

            if (selectableDesignerItemViewModelBase != null)
            {
                if ((Keyboard.Modifiers & (ModifierKeys.Shift | ModifierKeys.Control)) != ModifierKeys.None)
                {
                    if ((Keyboard.Modifiers & (ModifierKeys.Shift)) != ModifierKeys.None)
                    {
                        selectableDesignerItemViewModelBase.IsSelected = !selectableDesignerItemViewModelBase.IsSelected;
                    }

                    if ((Keyboard.Modifiers & (ModifierKeys.Control)) != ModifierKeys.None)
                    {
                        selectableDesignerItemViewModelBase.IsSelected = !selectableDesignerItemViewModelBase.IsSelected;
                    }
                }
                else if (!selectableDesignerItemViewModelBase.IsSelected)
                {
                    foreach (SelectableDesignerItemViewModelBase item in selectableDesignerItemViewModelBase.Parent.SelectedItems)
                    {
                        selectableDesignerItemViewModelBase.IsSelected = false;
                    }

                    selectableDesignerItemViewModelBase.Parent.SelectedItems.Clear();
                    selectableDesignerItemViewModelBase.IsSelected = true;
                }
            }
        }
Пример #2
0
 private void ExecuteRemoveItemCommand(object parameter)
 {
     if (parameter is SelectableDesignerItemViewModelBase)
     {
         SelectableDesignerItemViewModelBase item = (SelectableDesignerItemViewModelBase)parameter;
         items.Remove(item);
     }
 }
Пример #3
0
 private void ExecuteAddItemCommand(object parameter)
 {
     if (parameter is SelectableDesignerItemViewModelBase)
     {
         SelectableDesignerItemViewModelBase item = (SelectableDesignerItemViewModelBase)parameter;
         item.Parent = this;
         items.Add(item);
     }
 }