Below is my solution tree, where you can see, that App.xaml
is in G_Hoover.Init project, and BrowserView.xaml
window is in G_Hoover.Views project.
I am trying to figure out how to define StartupUri
in App.xaml
, that BrowserView.xaml
will be a startup window.
Only approach I found is here, but when I type in App.xaml
:
StartupUri="C:/Users/asus/Desktop/IT/Programowanie/Projekty/G_Hoover/G_Hoover.Views/BrowserView.xaml"
I receive an exception:
XamlObjectWriterException: Specified class name 'G_Hoover.Views.BrowserView' doesn't match actual root instance type 'System.Windows.Window'. Remove the Class directive or provide an instance via XamlObjectWriterSettings.RootObjectInstance.
When I type:
StartupUri="pack://application:,,,/G_Hoover;G_Hoover.Views/BrowserView.xaml">
I receive exception:
System.IO.IOException: 'Cannot locate resource 'g_hoover;g_hoover.views/browserview.xaml'.'
And the same results I have when I type it in App.xaml.cs
basing on this approach:
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
StartupUri = new Uri("pack://application:,,,/" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Name + ";G_Hoover.Views/BrowserView.xaml", UriKind.RelativeOrAbsolute);
//or this: StartupUri = new Uri("pack://application:,,,/G_Hoover;G_Hoover.Views/BrowserView.xaml", UriKind.RelativeOrAbsolute);
//or this: StartupUri = new Uri("C:/Users/asus/Desktop/IT/Programowanie/Projekty/G_Hoover/G_Hoover.Views/BrowserView.xaml");
}
}
Please note that G_Hoover.Init has reference to G_Hoover.Views. What am I doing wrong?