tags:

views:

27

answers:

1

I have a datagrid and it contains the list of files from the folder. I want to display the default window files right click options in right click on the filename.

That is when ever i right click the filename in the datagrid, a default windows right click pop up should appear.

Can anyone help me to sort this out. The project is in C#.

Thank you.

A: 

You should be able to add a Context menu to your data grid. The Context Menu will allow you to add in all the regular Windows right click menu options. The example below only shows copy, cut and paste.

<my:DataGrid
    ItemsSource="{Binding}"...>
    <my:DataGrid.ContextMenu>
       <ContextMenu >
           <MenuItem Command="Cut" />
           <MenuItem Command="Copy" />
           <MenuItem Command="Paste" />
       </ContextMenu>
    </my:DataGrid.ContextMenu>
</my:DataGrid>

You are able to add icons to the menu options as well if you'd like by writing the menu items more like this.

<MenuItem Command="Paste">
    <MenuItem.Icon>
        <Image Source="Images/paste.png" />
    </MenuItem.Icon>
</MenuItem>
Scott Boettger
Thank you Scott for the answer, but i m using datagridTemplateColumn. How can i use copy/Open file under datagridTemplateColumn.