使用查询字符串 wp7 在 itemtemplate 中导航

发布于 2024-12-19 23:03:59 字数 1574 浏览 2 评论 0原文

我在 wp7 应用程序内的 ListBox 中有一个 ListBox.ItemTemplate 。我想要的是当用户单击查询字符串中带有标题文本的标题时导航到某个页面。

目前它只是导航到某个页面。

 <ListBox x:Name="lbname"  >
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid Background="White">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="auto" />
                            <RowDefinition Height="auto" />
                        </Grid.RowDefinitions>
                        <TextBlock x:Name="tbTitle" Grid.Row="0" Text="{Binding Title}" TextAlignment="Left"   FontFamily="Segoe WP" Foreground="#000000" Style="{StaticResource PhoneTextTitle1Style}" >
                            <Custom:Interaction.Triggers>
                                <Custom:EventTrigger EventName="MouseLeftButtonDown">
                                    <ic:NavigateToPageAction TargetPage="/Views/somePage.xaml"/>
                                </Custom:EventTrigger>
                            </Custom:Interaction.Triggers>
                        </TextBlock>
                        <TextBlock  x:Name="tbDesc" Grid.Row="1" Margin="11,0,0,0" Text="{Binding Desc}" TextAlignment="Left"  FontFamily="Segoe WP" Foreground="#000000" TextWrapping="Wrap" Style="{StaticResource PhoneTextSubtleStyle}" />
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

怎么做呢?

I have a ListBox.ItemTemplate in ListBox inside wp7 app. What I want is to navigate to somepage when user clicks the title with titletext in querystring.

Currently it just navigates to somepage.

 <ListBox x:Name="lbname"  >
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid Background="White">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="auto" />
                            <RowDefinition Height="auto" />
                        </Grid.RowDefinitions>
                        <TextBlock x:Name="tbTitle" Grid.Row="0" Text="{Binding Title}" TextAlignment="Left"   FontFamily="Segoe WP" Foreground="#000000" Style="{StaticResource PhoneTextTitle1Style}" >
                            <Custom:Interaction.Triggers>
                                <Custom:EventTrigger EventName="MouseLeftButtonDown">
                                    <ic:NavigateToPageAction TargetPage="/Views/somePage.xaml"/>
                                </Custom:EventTrigger>
                            </Custom:Interaction.Triggers>
                        </TextBlock>
                        <TextBlock  x:Name="tbDesc" Grid.Row="1" Margin="11,0,0,0" Text="{Binding Desc}" TextAlignment="Left"  FontFamily="Segoe WP" Foreground="#000000" TextWrapping="Wrap" Style="{StaticResource PhoneTextSubtleStyle}" />
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

How to do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

中二柚 2024-12-26 23:03:59

设置 TargetPage="{绑定地址}" 怎么样?

How about setting TargetPage="{Binding Address}"?

忆沫 2024-12-26 23:03:59

我使用了 HyperlinkBut​​tonNavigateUri="{Binding NavigationURL}"

I used HyperlinkButton with NavigateUri="{Binding NavigationURL}"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文