Do you have an idea for an relatively simple app but just don't have the time to get it off the ground? Maybe you have a web site or blog, and you would like to add an app that surfaces the existing web UI. Even the simplest of apps requires a great deal of infrastructure code be built up front, right?
Windows Template Studio
Earlier this year, the WinDev team at Microsoft unveiled Windows Template Studio, a Visual Studio extension that makes UWP app development accessible to more developers.After installing the extension, select the new project type for Windows Template Studio (Universal Windows) found under Windows Universal. This will start a wizard-style experience to select the frameworks, pages and features to be added to your application.
The Wizard
I elected to create a Navigation Pane project using MVVMLight instead of the code-behind model for my app. I also added three Web View pages for my three blogs, named UWPTips, WPFTips and MorningDew.
Upon completing the wizard, the solution is loaded in Visual Studio 2017. Each view, in addition to the Main and Shell views, is generated along with a corresponding ViewModel.
Each of my Web View ViewModels has a constant defined for the initial web page to load into the View.
private const string defaultUrl = "https://developer.microsoft.com/en-us/windows/apps";Change each of these to the desired starting web Url for that View.
private const string defaultUrl = "http://www.uwpapp.tips";I made one additional change to the generated project. In the PopulateNavItems() method of ShellViewModel, I updated the symbols used as icons in the left navigation bar for each page. By default, each was using Symbol.Document. I changed this to make each page's symbol unique and more identifiable.
_primaryItems.Add(new ShellNavigationItem("Shell_Main".GetLocalized(), Symbol.Home, typeof(MainViewModel).FullName));The items in the Windows.UI.Xaml.Controls.Symbol enum correspond to glyphs from the Segoe MDL2 Assets font. More information is available on Microsoft Docs.
_primaryItems.Add(new ShellNavigationItem("Shell_UWPTips".GetLocalized(), Symbol.Pictures, typeof(UWPTipsViewModel).FullName));
_primaryItems.Add(new ShellNavigationItem("Shell_WPFTips".GetLocalized(), Symbol.PreviewLink, typeof(WPFTipsViewModel).FullName));
_primaryItems.Add(new ShellNavigationItem("Shell_MorningDew".GetLocalized(), Symbol.Link, typeof(MorningDewViewModel).FullName));
Here is a look at the app running on Windows 10 with the Creators Update. The left navigation hamburger menu has been expanded to reveal the page names, otherwise only the glyph icons appear. The WPFTips page has rendered the current content of www.wpf.tips.
The status bar area of each web view page contains basic navigation buttons for back, forward and reload plus a button to open the current page in your default browser. These web views are hosted in an embedded Microsoft Edge browser control. While an app that hosts three blog sites may not be a worthy addition to the Store, it could be made more useful by displaying individual blog posts in a 'reading mode' with sidebars, headers and footers from the sites hidden. This application style might be even more useful hosting pages containing document repositories or other online libraries.
Windows Template Studio v1.1 was just released last month, containing a number of additions, enhancements and fixes. The entire project is open source, with the source available on GitHub. Go check it out today and build something awesome!
Next time, in Tip #2, we will take a closer look at the code generated for my AppTips project and what is going on under the covers to navigate around the app.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.