![](/img/trans.png)
[英]Avoid animation of the parent of context menu in windows phone 8.1
[英]Get Parent control of context menu Windows phone
按住網格時有上下文菜單
<Grid Tag="1" Tap="Grid_Tap" Style="{StaticResource GridMedium}">
<Grid.Background>
<ImageBrush Stretch="Fill" ImageSource="/Assets/Images/Page/bg_haivl.png"/>
</Grid.Background>
<toolkit:ContextMenuService.ContextMenu>
<toolkit:ContextMenu>
<toolkit:MenuItem Header="pin to start" Tap="MenuItem_Tap"/>
</toolkit:ContextMenu>
</toolkit:ContextMenuService.ContextMenu>
<Image Source="/Assets/Images/Page/icon_haivl.png" HorizontalAlignment="Center" VerticalAlignment="Top" Width="94" Margin="0,14,0,0" />
<Image Source="/Assets/Images/Page/logo_haivl.png" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="32" Margin="8,0,0,10" />
</Grid>
如何通過隱藏MenuItem_Tap事件的代碼獲取<Grid Tag="1" Tap="Grid_Tap" Style="{StaticResource GridMedium}"></Grid>
private void MenuItem_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
MenuItem menuItem = (MenuItem)sender;
//...Select Grid here
}
<Grid x:Name ="MyGrid" Tag="1" Tap="Grid_Tap" Style="{StaticResource GridMedium}">
<Grid.Background>
<ImageBrush Stretch="Fill" ImageSource="/Assets/Images/Page/bg_haivl.png"/>
</Grid.Background>
<toolkit:ContextMenuService.ContextMenu>
<toolkit:ContextMenu>
<toolkit:MenuItem Header="pin to start" Tap="MenuItem_Tap"/>
</toolkit:ContextMenu>
</toolkit:ContextMenuService.ContextMenu>
<Image Source="/Assets/Images/Page/icon_haivl.png" HorizontalAlignment="Center" VerticalAlignment="Top" Width="94" Margin="0,14,0,0" />
<Image Source="/Assets/Images/Page/logo_haivl.png" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="32" Margin="8,0,0,10" />
private void MenuItem_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
MenuItem menuItem = (MenuItem)sender;
//MyGrid. // Access you grid here..
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.