I need OnDragEnter
event for every cell on my WPF Datagrid.
I tried this :
<ControlTemplate TargetType="{x:Type my:DataGridCell}" x:Key="RowTemplate">
<ContentPresenter DragEnter="ContentPresenter_DragEnter" >
</ContentPresenter>
</ControlTemplate>
But doesn't seem to work. Any ideas people?
Edit: Thanks for the responses, i realized that i was facing another problem though :
My real problem was that the TextBox
control always marks drag and drop events as handled so even if you set AllowDrop="True"
it will look like AllowDrop is not working. It is not a bug, this behavior is actually by design.
I used the Preview Events to anticipate to this, and be able to handle D'n'D events.
<TextBox
AllowDrop="True"
PreviewDragEnter="TextBox_PreviewDragOver"
PreviewDragOver="TextBox_PreviewDragOver"
PreviewDrop="TextBox_PreviewDrop">
<TextBox/>
Hope this helps.
I am marking your responses as answers as they were accurate regarding the initial question.