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

Problems with data binding in RadMenuItem inside ContextMenu

1 Answer 71 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Weverton
Top achievements
Rank 1
Weverton asked on 30 Mar 2011, 02:03 PM
Hi,

In my silverlight app there is a RadGridView who has a RadContextMenu with few RadMenuItems. I tried to configure the data binding to one of the RadMenuItems(I saw this demo: http://demos.telerik.com/silverlight/#Menu/DataBinding), but it didn't work.

<Grid>
    <Grid.Resources>
        <telerik:HierarchicalDataTemplate x:Key="menuItemTemplate" ItemsSource="{Binding Path=Category, Converter={StaticResource ToStringTodos}, Mode=OneWay}">
            <TextBlock Text="{Binding Value}" />
        </telerik:HierarchicalDataTemplate>
    </Grid.Resources>
 
    <telerikGridView:RadGridView Name="grdFeeds">
        <telerikControls:RadContextMenu.ContextMenu>
            <telerikControls:RadContextMenu>
                <telerikControls:RadMenuItem Header="Excluir"/>
                <telerikControls:RadMenuItem Header="Categoria" ItemTemplate="{StaticResource menuItemTemplate}" ItemsSource="{Binding Path=Category, Converter={StaticResource ToStringTodos}, Mode=OneWay}" />
            </telerikControls:RadContextMenu>
        </telerikControls:RadContextMenu.ContextMenu>
    </telerikGridView:RadGridView >         
</Grid>

Otherwise, I tried, just to test, do the same binding, but with RadMenuItem inside a RadMenu and all worked normally

<Grid>
    <Grid.Resources>
        <telerik:HierarchicalDataTemplate x:Key="menuItemTemplate" ItemsSource="{Binding Path=Category, Converter={StaticResource ToStringTodos}, Mode=OneWay}">
            <TextBlock Text="{Binding Value}" />
        </telerik:HierarchicalDataTemplate>
    </Grid.Resources>
  
    <telerikControls:RadMenu>
        <telerikControls:RadMenuItem Header="Alterações">
            <telerikControls:RadMenuItem Header="Categorias" ItemTemplate="{StaticResource menuItemTemplate}" ItemsSource="{Binding Path=Category, Converter={StaticResource ToStringTodos}, Mode=OneWay}" />
        </telerikControls:RadMenuItem>               
    </telerikControls:RadMenu>
</Grid>

What must I do to data binding work when RadMenuItem is inside RadContextMenu??

Thanks,

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 04 Apr 2011, 08:03 AM
Hello Weverton,

I guess that data context for both menu items (in RadMenu and in RadContextMenu attached on RadGridView) is the same?
You could check while in Debug in Visual Studio output window if there are failing bindings.

If there are no failing bindings please send us sample project. This way it will be much easier to help you.

Greetings,
Hristo
the Telerik team
Tags
GridView
Asked by
Weverton
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or