Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
595
Display context menu in xamdatagrid rows
posted

Hi,

How to display context menu in the datagrid rows and pass the selected menuitem header to command parameter ?

I tried the following code  but its not working.

                                            <igWpf:XamDataGrid.Resources>
                                                <Style TargetType="{x:Type igWpf:DataRecordCellArea}">
                                                    <Setter Property="ContextMenu">
                                                        <Setter.Value>
                                                            <ContextMenu ItemsSource="{Binding ContextMenuDatas}">
                                                                <ContextMenu.ItemContainerStyle>
                                                                    <Style TargetType="{x:Type MenuItem}">
                                                                        <Setter Property="Header" Value="{Binding Name}" />
                                                                        <Setter Property="Command" Value="{Binding DataContext.TestCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContextMenu}}}" />
                                                                        <Setter Property="CommandParameter" Value="{Binding Header, RelativeSource={RelativeSource Self}}" />
                                                                    </Style>
                                                                </ContextMenu.ItemContainerStyle>
                                                            </ContextMenu>
                                                        </Setter.Value>
                                                    </Setter>
                                                </Style>
                                            </igWpf:XamDataGrid.Resources>