This is a migrated thread and some comments may be shown as answers.

GridView context menu not working with header been a textblock

1 Answer 71 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Lax
Top achievements
Rank 1
Lax asked on 23 Mar 2015, 11:14 PM
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>


1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 26 Mar 2015, 11:12 AM
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.

 
Tags
GridView
Asked by
Lax
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or