Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Capturing Mouse Events inside DataTemplate

$
0
0

Hi,

I want to handle the mouse left button down event inside the datatemplate of the listbox.

This is my code:

<ListBox ItemsSource="{Binding Key}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal" >
                        <TextBlock Text="{Binding}" />
                        <Ellipse Margin="10,0,0,0" Height="10" Width="10" Stroke="Black" StrokeThickness="1" Name="Left"
                                PreviewMouseLeftButtonDown="Left_PreviewMouseLeftButtonDown"
                                 MouseLeftButtonDown="Left_MouseLeftButtonDown" />
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

But i am unable to handle those events in the "Ellipse".

May i know where i am mistaking.

Thanks in advance.


NANDAKUMAR.T


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>