Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing Shift key Multi selection of checkbox( Find Controls within 2 points/ rectangle
    primarykey
    data
    text
    <p>In order to select multiple checkbox within Wrap panel using Shift Key.</p> <p>Capturing the Mouse down event position on Shift Keydown, on second mouse down with shift keydown, getting the 2 positions of the selection, then Need to Select the checkbox control with in the selected area.</p> <p>How do I find the controls within 2 positions (System.Window.Point) or System.Windows.rect. The following code is selecting all of the checkbox within the wrappanel(lesscolorpanel).</p> <pre><code> private System.Windows.Point startPoint; System.Windows.Point checkpPoint; private System.Windows.Point PointWhereMouseIs; private void LessColourPanel_OnPreviewMouseDown(object sender, MouseButtonEventArgs e) { if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)) { if (startPoint == checkpPoint) { //GET THE MOUSE POSITION startPoint = Mouse.GetPosition(lessColourPanel); PointWhereMouseIs = checkpPoint; } else if(PointWhereMouseIs==checkpPoint) { //CAPTURE END MOUSE POSITION PointWhereMouseIs = Mouse.GetPosition(lessColourPanel); //FIND CONTROLS WIHIN RECTANGLE Rect selareaRect = new Rect(startPoint, PointWhereMouseIs); foreach (System.Windows.Controls.CheckBox chkitemBox in FindVisualChildren&lt;System.Windows.Controls.CheckBox&gt;(lessColourPanel)) { var rectBounds = VisualTreeHelper.GetDescendantBounds(chkitemBox); Vector vector = VisualTreeHelper.GetOffset(chkitemBox); rectBounds.Offset(vector); if (rectBounds.IntersectsWith(selareaRect)) { chkitemBox.IsChecked = true; } } startPoint = checkpPoint; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload