开发者

Single Window WPF Application

I've created a single window application and this application h开发者_JAVA技巧as 2 screens all shown in the main window. Logon screen and then the main application screen after successful logon. I've currently achieved this by using a navigation window and pages.

I'm not sure if this is the best approach as I do not need to use the functionality provided by the navigation window (Browse back and forward et cetera).

I'm hoping someone could let me know if the navigation window is the best approach for this design or if a similar look can be achieved by not using pages and navigationwindow.

Thanks for all your help.

Emlyn


There are many different ways. One rather simple way is to remove some control from the visual tree and add another into it instead. Apart from that I have seen a number of apps using Page/Frame and it works OK.


there's nothing to stop you implementing this as two Windows. The main window can be displayed after the completion of the succesful login from the first Window, and the first login window can be closed.

One thing you may need to be careful of is that the app doesn't exit after the first window closes but before the second is displayed. You can set the Application ShutdownMode property in you app.xaml if required.


You can use Pages and navwindow if you like. This can still encompass a MVVM pattern as the Views may be loaded as pages if needed.

To start your project create one window xaml document and change the Window tag to a Navigation Window tag

<NavigationWindow x:Class="myapp.NavigationWindow"
xmlns:....
Title:"My App"
Source="newpage.xaml" <!--designates the page to load -->
ShowsNavigationUI="False" <!--designates if the navbar is displayed at top-->
</NavigationWindow>

Then within each page you can control the navigation or loading of new pages using NavigationService

NavigationService.Navigate(newUri("mynewpage.xaml", UriKind.Relative));

If logging is not of any value for you in page navigation you can disable this in code if you need.

ps- If you are looking for MDI WPF/win-32 does not really support MDI (Multi-document interfaces) like Delphi so for times when you need to create a MDI appearance you can use TabView controls or rely more on a pattern development MVVM which provides a more elegant means to load and pass different UI controls.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜