Newbie
Newbie

Reputation: 1180

Windows Phone 7.8 - Finding properties of ContextMenu's parent

I'm making a simple note taking app in C# for windows phone 7.8. And I would like to know how to retrieve properties of the item clicked on through the context menu...

Here's the code for the HubTile

<toolkit:HubTile Title="{Binding Title}" Message="{Binding Details}" HorizontalAlignment="Left"   VerticalAlignment="Top" HorizontalContentAlignment="Left" VerticalContentAlignment="Bottom" Tap="HubTile_Tap" toolkit:TiltEffect.IsTiltEnabled="True" Hold="HubTile_Hold">
    <toolkit:ContextMenuService.ContextMenu>
        <toolkit:ContextMenu>
            <toolkit:MenuItem Header="Open" Click="hubTileOpen_Click"/>
            <toolkit:MenuItem Header="Edit" Click="hubTileEdit_Click"/>
            <toolkit:MenuItem Header="Delete" Click="hubTileDelete_Click"/>
        </toolkit:ContextMenu>
    </toolkit:ContextMenuService.ContextMenu>
</toolkit:HubTile>

So basically I want to be able to retrieve the Message and Title property of the HubTile though one of the context menu events.

Thanks, all help appreciated

Upvotes: 0

Views: 235

Answers (1)

Wojciech Kulik
Wojciech Kulik

Reputation: 8440

Inside click event:

(((sender as MenuItem).Parent as ContextMenu).Owner as HubTile).Title

Upvotes: 1

Related Questions