These days I wanna add a file select feature in my program.
I want to achieve select the file by drawing a rectangle with the mouse, just like the windows file explorer below:
In my opinion, I should use a WrapPanel
as a container, and then add CheckBoxs
which rewrote ControlTemplate
.
I have found some incomplete tutorial, just like:Drag selection box in WPF
Now I can draw the blue rectangle with my mouse by using the Adorner
.
However, I don't know how to get to know which CheckBoxs are in the rectangle.
What's more, I don't know whether my opinion by using WrapPanel
and CheckBox
is a good choice for this.
Could you please give me a suggestion or a sample? Thank you.