0

Modern UI for WPF のようなことを達成したいと考えています。私はMainWindow : NavigationWindowを持っています。ソースはページ/main.xamlで、その中のコードは次のようになります。

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

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

問題は、ページを切り替えるときに迷惑な音がすることです。「ナビ開始」という名前だと思います。再生できないようにすることはできますか? または、それを再生しないページを切り替える別の方法はありますか? 前もって感謝します。

(この質問がばかげている場合は申し訳ありませんが、私はWPFが初めてです)

4

1 に答える 1

0

ここに小さな回避策があります。ここで見つけた元のソース: 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("",""));
        }
    }
}
于 2013-06-30T21:15:04.863 に答える