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

Bind RadContextMenu menu in ListBox Items

2 Answers 102 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Mazdak
Top achievements
Rank 1
Mazdak asked on 11 Feb 2011, 03:38 PM
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 Answers, 1 is accepted

Sort by
0
Mazdak
Top achievements
Rank 1
answered on 11 Feb 2011, 10:44 PM
I've found the asswer, But I can't find any delete button here.

Thanks.
0
Rich
Top achievements
Rank 1
answered on 31 Oct 2013, 01:57 AM
The answer would have really come in handy.......
Tags
Menu
Asked by
Mazdak
Top achievements
Rank 1
Answers by
Mazdak
Top achievements
Rank 1
Rich
Top achievements
Rank 1
Share this question
or