-2

I have a Grid on WPF with 5 columns: ID , Name, Address, Salary, Phone. And Now i want to click Right Mouse to a row on grid. My main idea is I get ID on rows when i right click into "Detail" menu. My result is i don't get ID.

My Code is :

<DataGrid>
     <DataGrid.ContentMenu>
       <ContentMenu DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}">
         <MenuItem Header="Detail" cal:Message.Attach="Detail($dataContext)">
         </MenuItem>
      </ContentMenu>
    </DataGrid.ContentMenu>
</DataGrid>

1 Answers1

0

CM has and will always have a visual tree issue, meaning it can't map the ContextMenu until its in the visual tree...

So there exists Action.TargetWithoutContext

"No target found for method" thrown by Caliburn Message.Attach()

Community
  • 1
  • 1
mvermef
  • 3,814
  • 1
  • 23
  • 36