Hi all,
I kep the context menu in my grid..when i cllcik the any menu in my context menu iam not getting any active record..how to keep the context menu in left cliick..While I clicking the grid left clcik then the grid gives active record..
<igDP:XamDataGrid.ContextMenu> <ContextMenu x:Name="Contextmenu" Loaded
="Contextmenu_Loaded"> <MenuItem Name="Add" Header="Create Applet" Click="mnuAdd_Click"/> <MenuItem Name="Edit" Tag="{Binding Path=DataItem.AppletIntID}" Header="Update Applet" Click="mnuEdit_Click"/>
<MenuItem Name="Delete" Tag="{Binding Path=DataItem.AppletIntID}" Header="Delete Applet" Click="mnuDelete_Click"/>
<Separator/> <MenuItem Name="View" Tag="{Binding Path=DataItem.AppletIntID}" Header="View Applet" Click
="View_Click"/> </ContextMenu>
</igDP:XamDataGrid.ContextMenu>
class file code:
private void mnuEdit_Click(object sender, RoutedEventArgs e) {
DataRecord activerecord = (grdApplets.ActiveRecord as DataRecord); if (grdApplets.ActiveRecord != null) {
Int64 id; //edit code
}
Thanks for ur help..it works fine..I kept style for context menu like this
<Style TargetType="{x:Type igDP:DataRecordCellArea}" > <Setter Property="ContextMenu" Value="{StaticResource imageMenu}" /> </Style>
Hello,
The ContextMenu is associated with the Right mouse click and cannot be fired from a mouse left click. If you have troubles getting the ActiveRecord when the context menu opens, you can use something like this:
void DRP_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
DataRecordPresenter drp = sender as DataRecordPresenter;
if (drp != null)
drp.IsSelected = true;
You can see more information on this and ContextMenus in this blog post:
http://forums.infragistics.com/blogs/alex_fidanov/archive/2009/07/22/contextmenus-tooltips-mouse-clicks-amp-utilities.aspx
Hope this helps.