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
715
Creating a context menu for the column header
posted

Any reason why this won't work? The error complains that the ContextMenu cannot be assigned to something of type Object.

Thanks,

<igDP:XamDataGrid.Resources>
                <Style TargetType="{x:Type igDP:LabelPresenter}"
                       x:Key="HeaderContextMenu">
                    <Setter Property="ContextMenu">
                        <Setter.Value>
                            <ContextMenu>
                                <ContextMenu.Items>
                                    <ComboBoxItem Content="Edit Layout" />
                                </ContextMenu.Items>
                            </ContextMenu>
                        </Setter.Value>
                    </Setter>
                </Style>
            </igDP:XamDataGrid.Resources>

Parents
  • 69686
    posted

    Hello,

    It seems that the ContextMenu property cannot be assigned with a style's setter in this way. What you can use is :

                     <ContextMenu x:Key="cm">
                        <ComboBoxItem Content="Edit Layout" />
                    </ContextMenu>
                    <Style TargetType="{x:Type igDP:LabelPresenter}">
                        <Setter Property="ContextMenu" Value="{StaticResource cm}"/>
                    </Style>

Reply Children
No Data