Ejemplo n.º 1
0
        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)
                    {
                        item.IsSelected = false;
                    }

                    selectableDesignerItemViewModelBase.Parent.SelectedItems.Clear();
                    selectableDesignerItemViewModelBase.IsSelected = true;
                }
            }
        }
Ejemplo n.º 2
0
 private void ExecuteRemoveItemCommand(object parameter)
 {
     if (parameter is SelectableDesignerItemViewModelBase)
     {
         SelectableDesignerItemViewModelBase item = (SelectableDesignerItemViewModelBase)parameter;
         items.Remove(item);
     }
 }
Ejemplo n.º 3
0
 private void ExecuteAddItemCommand(object parameter)
 {
     if (parameter is SelectableDesignerItemViewModelBase)
     {
         SelectableDesignerItemViewModelBase item = (SelectableDesignerItemViewModelBase)parameter;
         item.Parent = this;
         items.Add(item);
     }
 }