My DataTemplatelooks like this:
DataTemplate
<DataTemplate x:Key="ItemTemplate"> <StackPanel MouseLeftButtonDown="StackPanel_MouseLeftButtonDown">
However, I can not catch the left mouse button. If I set the background of the template to some color, this is normal.
How to create transparent DataTemplateand catch an event MouseLefButtonDown?
MouseLefButtonDown
Thanks.
If you want to catch mouse events on the StackPanel itself, you just need to adjust the transparency of your brush:
<StackPanel MouseLeftButtonDown="StackPanel_MouseLeftButtonDown" Background="Transparent" Height="400" Width="400" > <Button Content="dfsdf"/>
MouseLeftButtonDown . , , "" . , StackPanel, MouseLeftButtonDown, , , , StackPanel.
MouseLeftButtonDown
StackPanel
PreviewMouseLeftButtonDown, , . , , "" , . :
PreviewMouseLeftButtonDown
<StackPanel PreviewMouseLeftButtonDown="StackPanel_PreviewMouseLeftButtonDown">
, .
Source: https://habr.com/ru/post/1715941/More articles:Boost Multi-Index Custom Composite Key Comparer - c ++The easiest way to import CSV into SQl Server 2005 is import.Net 2.0 Required installer - installer.sbr files in Source Control - version-controlHow to initialize a global array of structures in D? - initializationHow can I control the "View spaces between pages" in MS Word using VBA / Macros? - vbaNeed help creating a regular expression to match a specific string (example inside) - regexCan anyone define this image format? - imageCreating a CHANGE script in Management Studio? - sqlWant Joomla Super Admin to log in to other registered accounts - how to do this? - joomlaAll Articles