2016-08-24 64 views
-1
<Page 
    x:Class="MutiViewInRootPage.AppShell" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="using:MutiViewInRootPage" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:control="using:MutiViewInRootPage.Controls" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d"> 

<DataTemplate x:Key="NavMenuItemTemplate" x:DataType="local:NavMenuItem"> 

本土退出:NavMenuItem不退出namspaceSplitViewTemplate,所以我得到的錯誤是不以命名空間

<control:NavMenuListView x:Name="NavMenuList" 
              Grid.Row="1" 
              ItemsSource="{x:Bind NavList}" 
              ContainerContentChanging="NavMenuItemContrinerContentChanging" 
              ItemInvokded="NavMenuList_ItemInvoked" 
              ItemTemplate="{StaticResource NavMenuItemTemplate}"/> 

控制:NavMenuListView不退出...命名空間。在https://github.com/jamesmcroft/Windows-Universal-SplitViewTemplate/tree/master/AppTemplate

基地,我做到了如SplitViewTemplate但不退出...命名空間。 我無法解決這個問題。

+1

在鏈接的存儲庫中沒有提及'NavMenuListView'。 –

+0

基於樣本,我自己寫。所以我把不同的名字,但代碼是相同的。 –

回答

0

首先,請確保的NavMenuListView命名空間是正確的(這是很常見的,人們複製的代碼或文件,但忘記修改命名空間): enter image description here

其次,如果命名空間是正確的,但錯誤仍然存​​在,請嘗試編譯該項目。有時XAML編譯器在編譯之前無法識別新控件。編譯後,錯誤將會消失。

如果錯誤仍然存​​在,您可以通過在線存儲庫共享項目嗎?

更新:我下載了演示項目,並嘗試構建整個項目。並發現NavMenuList_ItemInvoked未實現。因此,我在代碼隱藏中添加了以下代碼:

private void NavMenuList_ItemInvoked(object sender, ListViewItem e){} 

然後構建成功完成。

+0

GitHub上的鏈接:[https://github.com/Englbach/MutiViewInRootPage](https://github.com/Englbach/MutiViewInRootPage) –

+0

我已更新答案。事實證明'NavMenuList_ItemInvoked'沒有實現。編寫一個空的事件處理程序並再次編譯修復了這個問題。 –