开发者

Navigate to browser from selected listbox binded hyperlink (windows phone7)

开发者 https://www.devze.com 2023-02-01 11:33 出处:网络
I am bindind rss items from the net to this page, I cannot Seem to navigate to the link of a selected items hyper link which through binding is string. can anyone help me to navigate to weblink from a

I am bindind rss items from the net to this page, I cannot Seem to navigate to the link of a selected items hyper link which through binding is string.

can anyone help me to navigate to weblink from a listbox item when selected ???

<ListBox Height="712" HorizontalAlignment="Left" Name="listNews" VerticalAlignment="Top" Width="468" SelectionChanged="listNews_SelectionChanged" Margin="0,-22,0,0">
    <ListBox.ItemTemplate>
        <DataTemplate>
            <StackPanel Ori开发者_高级运维entation="Horizontal" Height="132">
                <Image Source="{Binding Avatar}" Height="73" Width="73" VerticalAlignment="Top" Margin="0,7,5,0"/>
                <StackPanel Width="370">   
                    <TextBlock Text="{Binding Newstitle}" TextWrapping="Wrap" Foreground="#FFC8AB14" FontSize="28" />
                    <HyperlinkButton Name="{Binding NewsLink}" Content="{Binding NewsLink}" NavigateUri="{Binding NewsLink}" FontSize="18" ClickMode="Press" Click="Selected" />
                </StackPanel>
            </StackPanel>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>


   private void listNews_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        WebBrowserTask webBrowserTask = new WebBrowserTask();
        webBrowserTask.URL = **???????;**

        webBrowserTask.Show();


Try setting Target for your Hyperlink to "_blank".

Richard outlines the idea in more detail here.

Problem opening web browser with HyperlinkButton


Look @ this question on MSDN Forums:

How can I make an External Hyperlink

It uses WebBrowserTask to open browser and navigate to given url.

0

精彩评论

暂无评论...
验证码 换一张
取 消