Exemple #1
0
 private void dgPrevRepairInfo_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (dgPrevRepairInfo.SelectedItem != null)
     {
         frmRepairPRI pri = new frmRepairPRI((PreviousRepairInformation)dgPrevRepairInfo.SelectedItem);
         pri.Show();
     }
 }
Exemple #2
0
        private void OpenRepair(object sender, RoutedEventArgs e)
        {
            //Get the clicked MenuItem
            MenuItem menuItem = (MenuItem)sender;

            //Get the ContextMenu to which the menuItem belongs
            ContextMenu contextMenu = (ContextMenu)menuItem.Parent;

            //Find the placementTarget
            DataGrid item = (DataGrid)contextMenu.PlacementTarget;

            //Get the underlying item, that you cast to your object that is bound
            //to the DataGrid (and has subject and state as property)
            Record recordToOpen = (Record)item.SelectedCells[0].Item;

            //Open form with Record as PRI
            frmRepairPRI frm = new frmRepairPRI(recordToOpen);

            frm.Show();
        }