I need to set focus to UserControl
itself, not its child.
Otherwise I cannot implement insertion from the buffer. :(
Setting Focusable=True
doesn't help.
Google and SO tells only how to set focus to UserControl child.
My control contains:
- Toolbar with several buttons bound to commands of the corresponding
VM
- TextBox which is the input for the filter
- DataGrid - list of items.
I need to bind Ctrl+V command to VM. But to handle this gesture UserControl
must have focus within. When there are no items in the grid (VM's collection is empty) buttons are disabled and the only element which can get focus is TextBox
. But it handles Ctrl+V in its own way and I don't want to change this behavior.
Thus, I need something to set focus to when I click the area of UserControl.
I believe UserControl is the best candidate for it.
But I don't know how to make it selectable.
Otherwise I cannot implement insertion from the buffer
- Can you please explain this better? your question is too vague dude, I can't understand. Also post your current code and XAML. – Federico Berasategui