Bind RadContextMenu menu in ListBox Items

3 posts, 0 answers
  1. Mazdak
    Mazdak avatar
    30 posts
    Member since:
    Nov 2010

    Posted 11 Feb 2011 Link to this post

    Hi,

    I want to use a context menu into my ListBox Items, I want to each item has a context menu and items in context menu will bring up a new window. I've bind the Menu with this code:

    <ListBox Grid.Column="0" Grid.Row="0"  HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="FileListBox" VerticalAlignment="Top" BorderThickness="0">
                            <ListBox.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <toolkit:WrapPanel Orientation="Horizontal" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="FileWrapPanel" VerticalAlignment="Stretch" Width="490" />
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>                        
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Vertical" Margin="10,0">
                                        <TextBlock Text="{Binding wisdom_files.file_name, Converter={StaticResource ImageSourceFormatter}}" Name="FileNameText1"/>
                                        <TextBlock Text="{Binding wisdom_files.file_name}" Name="FileNameText"/>                                    
                                    </StackPanel>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                            <telerik:RadContextMenu.ContextMenu>
                                <telerik:RadContextMenu x:Name="ContextMenu" >
                                    <telerik:RadMenuItem Header="Edit Competencies" />
                                    <telerik:RadMenuItem Header="Open File" />
                                </telerik:RadContextMenu>
                            </telerik:RadContextMenu.ContextMenu>
                        </ListBox>

    The question is how should I Bind my parameter to ContextMenu from my datasource, and then second how I open a new window and pass my parameter into it.

    Regards
    Mazdak
  2. Mazdak
    Mazdak avatar
    30 posts
    Member since:
    Nov 2010

    Posted 11 Feb 2011 Link to this post

    I've found the asswer, But I can't find any delete button here.

    Thanks.
  3. DevCraft banner
  4. Rich
    Rich avatar
    8 posts
    Member since:
    Jul 2011

    Posted 30 Oct 2013 Link to this post

    The answer would have really come in handy.......
Back to Top