Quantcast
Viewing all articles
Browse latest Browse all 18858

WPF StartupUri with parameters

I am using following code in the app.xaml.cs for OnStartup event.

this.StartupUri = new Uri("MainWindow.xaml", UriKind.Relative);

 TranslationManager.Instance.LanguageChanged += (o, args) =>
            {
                var xmlLanguage = XmlLanguage.GetLanguage(TranslationManager.Instance.CurrentLanguage.IetfLanguageTag);

                if (Application.Current.MainWindow != null)
                    Application.Current.MainWindow.Language = xmlLanguage;
                

                foreach (var window in Application.Current.Windows.OfType<Window>())
                    window.Language = xmlLanguage;
            };

            TranslationManager.Instance.TranslationProvider = new ResourceDictionaryTranslationProvider(true);
            TranslationManager.Instance.CurrentLanguage = Thread.CurrentThread.CurrentCulture;

I'm using paramater in the mainwindow.xaml.cs class like this,

 public partial class MainWindow : NotifyWindow
    {
  public MainWindow(bool flag = false)
        {
         }
}

so how to use this "MainWindow.xaml" screen in the OnStartup  event.

please help me.



Viewing all articles
Browse latest Browse all 18858

Trending Articles