Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I have used a WPF Combobox having a Grid placed in DataTemplate inside ItemTemplate of the Combobox.
I am trying to access keyup event of that particular grid. But it does not fire.

Thank you.
Posted
Comments
Sergey Alexandrovich Kryukov 15-Nov-11 0:51am    
What do you mean "access event"? Can you show some code sample?
--SA
dhavalsb 15-Nov-11 1:08am    
<combobox x:name="cmb" margin="0,0,5,0" height="46" width="46" horizontalalignment="Center" verticalalignment="Top">
<combobox.itemtemplate>
<datatemplate>
<grid name="cmbUserDeviceItemBorder" height="40" removed="Transparent" minwidth="175" maxwidth="200" verticalalignment="Stretch" horizontalalignment="Stretch" mouseleftbuttonup="Border_MouseLeftButtonUp">
<border snapstodevicepixels="true" margin="0">
<stackpanel height="40" tag="{Binding }" orientation="Horizontal" x:name="stk">
<Image Source="{Binding Image}" Height="22" Width="22" VerticalAlignment="Center" HorizontalAlignment="Center" ></Image>
<textblock text="{Binding Text}" margin="5,0,5,3" style="{DynamicResource TextNormal}" foreground="White" verticalalignment="Center" horizontalalignment="Center">







This is the designing part and you can see the "MouseLeftButtonUp" event for the grid.
Now my question is whether there is any event that can be used by keyboard "Enter" key press?

1 solution

This is pretty easy stuff. You need to use EventSetter like

C#
<eventsetter event="KeyUp" handler="KeyUp_Handler" />


then write the code for KeyUp_Handler
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900