Question

I develop a game guide application with c# for windows 8. I'm trying to put 2 youtube videos in a specific chapter of the game and I want to change the Uri of the Webview via a button. when the button is not pressed the first video uri is to be shown and when the button IS pressed the second video is to be shown. how can I do that? for example:

    private void Chapters_SelectionChanged(object sender, Windows.UI.Xaml.Controls.SelectionChangedEventArgs e)
    {           
        switch (Chapters.SelectedIndex)
        { 
            case 0:

                Chapter2C.Visibility = Visibility.Visible;
                Chapter2T.Visibility = Visibility.Visible;
                next_but.Visibility = Visibility.Visible;
                prev_but.Visibility = Visibility.Visible;
                Mywebview.Visibility = Visibility.Visible;
                if (next_button.Clicked)
                 {
                    Mywebview.Source = new Uri("http://www.youtube.com/embed/F65paVQ0wn8?feature=player_detailpage") 
                 }
                   else 
                 {
                    Mywebview.Source = new Uri ("http://www.youtube.com/embed/rLdrc7K5vdw");
                 }
                 break;
        }
   }

anyone??

Was it helpful?

Solution

You can use toggle button.

<ToggleButton x:Name="btnChangeChapter" Content="Change Chapter" Click="btnChangeChapter_Click_1"/>

private void btnChangeChapter_Click_1(object sender, RoutedEventArgs e)
{
    /* TODO: use property btnChangeChapter.IsChecked.Value in SelectionChanged event,
            it's bool value */
}

If you want to use ToggleButton as app bar button style then check this out.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top