GridView context menu not working with header been a textblock

2 posts, 0 answers
  1. Lax
    Lax avatar
    15 posts
    Member since:
    Mar 2015

    Posted 23 Mar 2015 Link to this post

    Hi,

    I have followed this post from Telerik documentation to show context menu on the radgrid to choose columns of the grid.

    http://docs.telerik.com/devtools/wpf/controls/radgridview/columns/how-to/use-radcontextmenu-mvvm.html

    But, as we need to wrap header text, we are using textblock for it like  below, due to which header text and the context menu items are not in sync. And so, I have ended up writing code in the radcontextmenu events in the code behind file to manually chose columns etc. Just wondering if there is a xaml way to achieve the same even when header text is placed inside a textblock or am I missing anything here?

    Thanks,
    Lax
    <telerik:GridViewDataColumn DataMemberBinding="{Binding Balance, StringFormat=N0}" TextAlignment="Right" >
                            <telerik:GridViewDataColumn.Header>
                                <TextBlock Text="Balance prior deductions" TextWrapping="Wrap" Width="100px"/>
                            </telerik:GridViewDataColumn.Header>
    </telerik:GridViewDataColumn>


  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 26 Mar 2015 Link to this post

    Hello,

    The Header is an object. As MenuItem's Header is bound to column's header, you can specify a converter for the binding and dig to find the value you would like to populate.

    Regards,
    Dimitrina
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top