Modern UI for WPF 開源項目(3):用模板建立我的第一個Modern UI app

來源:互聯網
上載者:User

通過項目模板建立一個Modern UI app

做這個之前,請確保安裝了Modern UI for WPF Templates extension for Visual Studio 2012.

  • Download and install the VSIX extension from the Visual Studio gallery

or

  • In Visual Studio 2012, open the extension manager (Tools > Extensions and Updates)
  • Select Online > Visual Studio Gallery and search for 'modern ui'
  • Select Modern UI for WPF Templates and click Download to download and install.

1.建立一個新項目,選擇新的模板:Modern UI WPF Application

此應用程式模板包含了兩個頁面:Home.xaml和Setting.xaml和主表單MainWindow.xaml

Settings頁面提供了一些風格設定選項。Page頁面往往放在了Pages專案檔夾中。Content檔案夾常用於標準的WPF使用者控制項被各個頁面引用。

2.編譯和運行程式,你可以看到如下效果:

3.通過右擊Pages檔案夾,選擇 添加>新項目... 添加一個新的Basic layout page。在添加新項目對話方塊中選擇Modern UI for WPF列表中的Basic Page。名稱為BasicPage.xaml並點擊添加

4.引用新的頁面到主菜單。開啟MainWindow.xaml並找到mui:ModernWindow.MenuLinkGroups元素定義主菜單。添加一個新的連結到菜單組,命名為"welcome“如下:

<mui:ModernWindow.MenuLinkGroups>  <mui:LinkGroup DisplayName="welcome">    <mui:LinkGroup.Links>      <mui:Link DisplayName="home" Source="/Pages/Home.xaml" />      <mui:Link DisplayName="my page" Source="/Pages/BasicPage.xaml" />    </mui:LinkGroup.Links>  </mui:LinkGroup>  ...</mui:ModernWindow.MenuLinkGroups>

5.編譯和運行程式。在主菜單中選擇my page選項,你可以看到如下效果:

這樣就完成了,就是這麼簡單就建立了一個新的Modern UI 應用程式項目並使用visusal studio的擴充模板添加了頁面。通過添加連結指向新的頁面。

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.