I’ve noticed a strange bug when creating a desing with xaml:
sometimes I’m able to “select” controls the way I’d select text.
Normally the controls would look like this:

while if accidental selection happens, it looks like this:

Why does this happen, and how do I prevent it?
UPDATE
Here’s the controls that I’m using:
TreeView->Expander->StackPanel->DataGrid
Based on the answers, the problem probably originates from TreeView.
How do I prevent TreeView items from being selected?
It appears your control is based off a listbox which supports being able to select items in that manner. Perhaps change the underlying control to be based on an ‘items control’ instead.
Edit:
Tree view has the same behavior allowing to select an item. See this question…
Disable WPF TreeView (or TreeViewItem) selection?