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

How to handle MouseUp event on a ContextMenu

$
0
0

Hey there,

I have an Image that represents a button, and I created a ContextMenu to drop down when image is clicked. I have also added some StackPanels to the ContextMenu and I added Image and Textblock to each Stackpanel so they pretend as menu items.

Look at my work: 

So, the problem is that I need to get click from the menu item, not just from Stackpanel, because Stackpanel is smaller than the width of menu item.

Here's my XAML:

<Image x:Name="Sucelje_Slika_Datoteka" MouseUp="DatotekaMeni_Klik" ContextMenuService.IsEnabled="False" HorizontalAlignment="Left" Height="29" VerticalAlignment="Top" Width="76"><Image.ContextMenu><ContextMenu> <StackPanel Orientation="Horizontal" Width="240"><Image Source="Resources/NoviDokumentIkona.png" Width="30" Height="30"/><TextBlock Text="Novi dokument..." Margin="10,0,0,0" FontFamily="Titillium" FontSize="16" VerticalAlignment="Center"/></StackPanel><StackPanel Orientation="Horizontal"><Image Source="Resources/OtvoriDokumentIkona.png" Width="30" Height="30"/><TextBlock Text="Otvori dokument..." Margin="10,0,0,0" FontFamily="Titillium" FontSize="16" VerticalAlignment="Center"/></StackPanel>

</Image>

Please help!


Knowledge: C, C++, C#, Java, Pawn



Viewing all articles
Browse latest Browse all 18858

Trending Articles



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