How to bind to resource from codebehind without using DataContext
I have a datagrid with messages, which has declared itemsource in codebehind. TO every row I need to add contextmenu from which user can select user to whom he wants forward a message.
<!-- COLUMN: DATE SENT -->
<d开发者_如何转开发ata:DataGridTemplateColumn x:Name="DateSentColumn" CanUserSort="True"
SortMemberPath="DateSent" Width="80">
<data:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding DateSent, ConverterParameter=False, Converter={StaticResource cnvDate}}"
ToolTipService.ToolTip="{Binding DateSent, ConverterParameter=True, Converter={StaticResource cnvDate}}"
VerticalAlignment="Center"
FontWeight="{Binding IsBold, Converter={StaticResource cnvFontWeight}}"
Foreground="{Binding IsOverdueMessage, Converter={StaticResource cnvOverdue}}"
Margin="5,0,5,0">
<telerik:RadContextMenu.ContextMenu>
<telerik:RadContextMenu x:Name="inboxContextMenu" Opened="inboxContextMenu_Opened" ItemClick="inboxContextMenu_ItemClick">
<telerik:RadMenuItem x:Name="ForwardMessageMenuItem" Header="Forward message">
<telerik:RadMenuItem x:Name="SelectUserMenuItem"/>
</telerik:RadMenuItem>
</telerik:RadContextMenu>
</telerik:RadContextMenu.ContextMenu>
</TextBlock>
</DataTemplate>
</data:DataGridTemplateColumn.CellTemplate>
</data:DataGridTemplateColumn>
I don't know how can I bind users to SelectUserMenuItem radmenuitem.
In code behind I have a property Users.
精彩评论