我的textblock导航到新页面时遇到问题!好吧,导航不是问题!,我有一个与其连接的故事板的视图框,所以当我点击它时,视图框会展开或折叠,但是在这个视图框旁边我有一个上面有颜色的文本块,当我点击那个彩色文本框时,它应该导航到另一个屏幕,但它的作用是,它首先扩展视图,然后在导航中!,任何想法?
单击后打开,然后导航,希望在单击绿色块时不展开
这是对viewbox和textblock_tap事件的编码:
private void viewboxHeader_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
vb = (Viewbox)sender;
Storyboard sbExpand = new Storyboard();
Storyboard sbCollapse = new Storyboard();
sbExpand = (Storyboard)vb.TryFindResource("Expand");
sbCollapse = (Storyboard)vb.TryFindResource("Collapse");
string Status = vb.Tag.ToString();
if (Status == "1")
{
descend = false;
sbCollapse.Begin();
vb.Tag = 0;
}
if (Status == "0")
{
descend = true;
sbExpand.Begin();
vb.Tag = 1;
}
}
private void TextBlock_Tap_1(object sender, System.Windows.Input.GestureEventArgs e)
{
this.NavigationService.Navigate(new Uri("/UI/frmWFDocumentDetail.xaml", UriKind.Relative));
}
提前致谢! 我使用Visual Studio 2012 / silverlight / windows phone 8 app! windows 8 sdk
答案 0 :(得分:1)
只需将事件标记为已处理,以防止它传播到父控件:
private void TextBlock_Tap_1(object sender, System.Windows.Input.GestureEventArgs e)
{
e.Handled = true;
this.NavigationService.Navigate(new Uri("/UI/frmWFDocumentDetail.xaml", UriKind.Relative));
}