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

How to fetch item

1 Answer 55 Views
ContextMenu
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
David
Top achievements
Rank 1
David asked on 13 Aug 2013, 11:11 AM
I have a ListBox that contains data bound TextBoxes. The TextBox has a Context Menu.

In my Tapped event handlers, I can't figure out how to access the TextBox, and it's bound element, that the user long pressed on (it may or may not be selected, so I can't just use the ListBox). The ContextMenu documentation says to use GetElementUnderMenu(), but I can't find any documentation or examples on how to use it.

Any help or suggestions would be greatly appreciated.

    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <StackPanel>
            <TextBlock TextWrapping="Wrap" Text="{Binding Path=LocalizedResources.ProfilesPageInstructions, Source={StaticResource LocalizedStrings}}" Height="104" HorizontalAlignment="Center"/>
            <ListBox x:Name="listBox">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel x:Name="sp">
                            <TextBlock Text="{Binding profileName}" FontSize="{StaticResource PhoneFontSizeLarge}" />
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
                <telerikPrimitives:RadContextMenu.ContextMenu>
                    <telerikPrimitives:RadContextMenu OpenGesture ="Hold" x:Name="menu" Opening="OnMenuOpening"  IsFadeEnabled="True" IsZoomEnabled="True" >
                        <telerikPrimitives:RadContextMenuItem Content="delete" Tapped="deleteTapped"/>
                        <telerikPrimitives:RadContextMenuItem Content="rename" Tapped="renameTapped"/>
                    </telerikPrimitives:RadContextMenu>
                </telerikPrimitives:RadContextMenu.ContextMenu>
            </ListBox>
        </StackPanel>
    </Grid>
</Grid>

1 Answer, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 15 Aug 2013, 11:10 AM
Hello David,

Thank you for contacting us. I'd strongly suggest you take a look at the ContextMenu examples which are part of the Telerik Examples. The example (FirstLook) demonstrates how to use a context menu in combination with RadDataBoundListBox.
Another option would be to get your hands on the source code of the example which is located under C:\Program Files (x86)\Telerik\RadControls for Windows Phone 8 Q2 2013\Examples after installing the RadControls for Windows Phone 8 suite.

Give it a try and let me know how it works for you.

Regards,
Kiril Stanoev
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
ContextMenu
Asked by
David
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Share this question
or