0

I want to accomplish something like they have in Modern UI for WPF. I have MainWindow : NavigationWindow, which source is page /main.xaml and my code in it looks like this:

public partial class main : Page
{
    public main()
    {
        InitializeComponent();
    }

    private void settings_Click(object sender, RoutedEventArgs e)
    {
        settings settingsmenu = new settings();
        this.NavigationService.Navigate(settingsmenu);
    }
}

The problem is, that when i switch pages, annoying sound appears. I think it's named "navigation start". Can i prevent it from playing ? Or is there another way to switch pages, that doesn't play it ? Thanks in advance.

(sorry if this question is dumb, but I'm new to WPF)

raam86
  • 6,785
  • 2
  • 31
  • 46
  • Do you maybe look for a TabControl? http://tech.pro/tutorial/730/the-wpf-tab-control-inside-and-out – Lucas Jun 30 '13 at 20:16
  • Nope, i just want to have button and on click change window content. In Modern UI for WPF they are doing the thing i want with . I want to do exactly same thing, only with button. Have a look at http://mui.codeplex.com/wikipage?title=My%20first%20Modern%20UI%20app&referringTitle=Documentation – Vojtěch Sajdl Jun 30 '13 at 20:29

1 Answers1

0

Here is a small workaround. Original sources I found here: http://social.msdn.microsoft.com/Forums/vstudio/en-us/843677f4-8f0b-46cb-986c-92e8042d0707/stupid-problem-with-webbrowser-control

using System.Windows;
using System.Windows.Controls;
using Microsoft.Win32;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for Page1.xaml
    /// </summary>
    public partial class Page1 : Page
    {
        private RegistryKey regKeyCurrentUser;
        private RegistryKey regSubKeyCurrent;

        public Page1()
        {
            InitializeComponent();
        }

        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            var page2 = new Page2();
            this.NavigationService.Navigate(page2);
        }

        private void Page1_OnLoaded(object sender, RoutedEventArgs e)
        {
            regKeyCurrentUser = Registry.CurrentUser;
            regSubKeyCurrent = regKeyCurrentUser.OpenSubKey(@"AppEvents\Schemes\Apps\Explorer\Navigating\.Current", true);
            regSubKeyCurrent.SetValue("", "");
        }

        private void Page_Unloaded(object sender, RoutedEventArgs e)
        {
            var regSubKeyDefault = regKeyCurrentUser.OpenSubKey(@"AppEvents\Schemes\Apps\Explorer\Navigating\.Default");
            regSubKeyCurrent.SetValue("", regSubKeyDefault.GetValue("",""));
        }
    }
}