I'm trying to make an aplication where I have a lot of link to differen web sites on a stackpanel, getting there content from a MainViewModel, so when I click on the description it opens the web via WebBrowserTask. However, I want to have the Uri on the MainViewModel and get that info in the .cs, which takes me to the site
My xaml code is
<ListBox Margin="0,0,-12,0" ItemsSource="{Binding Items}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="0,0,0,17" Tap=Open_Web>
<Image Height="100" Width="100" Margin="0,0,0,0" Source="{Binding ImgWeb}" HorizontalAlignment="Left"/>
<StackPanel Width="311">
<TextBlock Text="{Binding LineOne}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
<TextBlock Text="{Binding LineTwo}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
My .cs is
private void Open_Web(object sender, RoutedEventArgs e)
{
WebBrowserTask webBrowserTask = new WebBrowserTask();
webBrowserTask.Uri = new Uri("I DONT KNOW");
webBrowserTask.Show();
And my MainViewModel code is:
this.Items.Add(new ItemViewModel() { LineOne = "Web Name", LineTwo = "Web description", Uri = "http://WebSite.com" });
If I dont bind the info, It works, but I dont know how to get the Uri on
webBrowserTask.Uri = new Uri("I DONT KNOW");
form the MainViewModel