继续在x:DataType上获得错误

时间:2018-02-02 15:51:04

标签: c# windows xaml windows-8.1

我一直在"属性' DataType'来自XAML命名空间的未定义。 [属性'数据类型'来自XAML命名空间未定义] [1]

<Page
   x:Class="VisitorApp.sample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:VisitorApp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:data="using:VisitorApp.Common" 
mc:Ignorable="d">
    <Page.Resources>
        <DataTemplate x:Key="GuestListDataTemplate" x:DataType="data:GuestGlobal">
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                <StackPanel Margin="20,20,0,0">
                <TextBlock Text="{Binding GuestName}" HorizontalAlignment="Left" FontSize="16" />
                <TextBlock Text="{x:Bind HostName}" HorizontalAlignment="Left" FontSize="10" />
                </StackPanel>
            </StackPanel>
       </DataTemplate>
    </Page.Resources>
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Margin="0,20,20,0">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="100" />
        </Grid.RowDefinitions>
        <TextBlock Grid.Row="1" 
               Name="ResultTextBlock" 
               FontSize="24" 
               Foreground="Red" 
               FontWeight="Bold" 
               Margin="20,20,0,0" />
        <GridView ItemsSource ="{x:Bind Guests}" 
              ItemClick="ListView_ItemClick" 
              IsItemClickEnabled="True" 
              ItemTemplate="{StaticResource GuestListDataTemplate}">
        </GridView>
    </Grid>
</Page>

强文

1 个答案:

答案 0 :(得分:0)

这帮助了我https://msdn.microsoft.com/en-us/magazine/mt683802

谢谢大家的贡献。