예제 #1
0
 public SelectionStateChangedArgs(RoutedEvent routedEvent, FrameworkElement owner, SelectionBox selectionBox, bool isSelecting)
     : base(routedEvent)
 {
     Owner        = owner;
     SelectionBox = selectionBox;
     IsSelecting  = isSelecting;
 }
예제 #2
0
 public SelectionBoxHandler(FrameworkElement owner, SelectionBox selectionBox)
 {
     AssertSelectionBoxProperties(owner, selectionBox);
     SelectionBox   = selectionBox;
     Owner          = owner;
     ElementManager = new SelectionBoxElementManager(Owner, SelectionBox);
     OwnerUIManager = new SelectionBoxOwnerUIManager(Owner, SelectionBox, ElementManager);
 }
예제 #3
0
        private void AssertSelectionBoxProperties(FrameworkElement owner, SelectionBox selectionBox)
        {
            owner.AssertParameterNotNull(nameof(owner));
            selectionBox.AssertParameterNotNull(nameof(selectionBox));
            selectionBox.TargetType.AssertParameterNotNull(nameof(SelectionBox.TargetType));
            selectionBox.TargetSelectionProperty.AssertParameterNotNull(nameof(SelectionBox.TargetSelectionProperty));
            selectionBox.VisualTraverser.AssertParameterNotNull(nameof(SelectionBox.VisualTraverser));

            if (!typeof(FrameworkElement).IsAssignableFrom(selectionBox.TargetType))
            {
                throw new Exception($"Error : Only FrameworkElements can be targeted by a SelectionBox. The given target type {SelectionBox.TargetType.Name} " +
                                    $"does not extend FrameworkElement.");
            }
            if (selectionBox.TargetSelectionProperty == null ||
                selectionBox.TargetSelectionProperty.ReadOnly ||
                selectionBox.TargetSelectionProperty.PropertyType != typeof(bool))
            {
                throw new Exception($"Error : The target selection property represents the property if, which set, selects the UIElement of the item found inside the SelectionBox. " +
                                    $"This cannot be null or readOnly and it's TargetType must be bool.");
            }
        }
예제 #4
0
 public SelectionBoxElementManager(FrameworkElement owner, SelectionBox selectionBox)
 {
     Owner        = owner;
     SelectionBox = selectionBox;
 }
예제 #5
0
 private SelectionBoxAdorner CreateSelectionBoxAdorner(FrameworkElement owner, SelectionBox selectionBox, Point startPoint)
 {
     return(new SelectionBoxAdorner(owner)
     {
         StartPoint = startPoint,
         Color = selectionBox.Background,
         Border = new Pen(selectionBox.BorderBrush, selectionBox.BorderThickness)
     });
 }
예제 #6
0
 public SelectionBoxOwnerUIManager(FrameworkElement owner, SelectionBox selectionBox, SelectionBoxElementManager elementManager)
 {
     Owner          = owner;
     SelectionBox   = selectionBox;
     ElementManager = elementManager;
 }