The following XAML in app.xaml works:
<Application.MainWindow>
<NavigationWindow Visibility="Visible" Source="MainWindow.xaml"></NavigationWindow>
</Application.MainWindow>
But changing this to
<Application.MainWindow>
<Window Visibility="Visible" Source="MainWindow.xaml"></Window>
</Application.MainWindow>
Means that I can't specify the Source
. Can anyone tell me how to specify the source for a non-navigation window?
Source
is Dependency Property on navigation window and not available on Window.
In case you want to make MainWindow.xaml
as startup window for your application ie MainWindow of application, you can specify StartupUri
on Application itself:
<Application StartupUri="MainWindow.xaml">
In case you need to set Application MainWindow , you have to provide instance of window like this:
<Application xmlns:local="clr-namespace:ActualNamespace">
<Application.MainWindow>
<local:MainWindow/>
</Application.MainWindow>
</Application>
Replace ActualNamespace
with namespace where MainWindow
resides.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.