Windows Phone的应用程序8.1不看的DataTemplate数据类型属性 [英] Windows Phone 8.1 App dont see DataType property in DataTemplate

查看:195
本文介绍了Windows Phone的应用程序8.1不看的DataTemplate数据类型属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了全新的Windows Phone 8.1的项目,当我尝试设置的数据类型,vs2013给我编辑的错误:属性数据类型不是类型'的DataTemplate 找到。在WPF应用程序我没有这个问题。 ?如何解决这个问题。



这是我的MainPage.xml:

 <第
X:类=App6.MainPage
的xmlns =htt​​p://schemas.microsoft.com/winfx/2006/xaml/presentation
的xmlns:X = http://schemas.microsoft.com/winfx/2006/xaml
的xmlns:本地=使用:App6
的xmlns:D =http://schemas.microsoft.com/expression/混合/ 2008
的xmlns:MC =http://schemas.openxmlformats.org/markup-compatibility/2006
MC:可忽略=D
背景={ThemeResource ApplicationPageBackgroundThemeBrush }>

< Page.Resources>
<数据类型的DataTemplate ={X:类型本地:员工}>
< TextBlock的文本={绑定名称}/>
< / DataTemplate中>
< /Page.Resources>

<网格和GT;

< /网格和GT;
< /页>


解决方案

数据类型的不支持在WinRT的XAML - 看的的DataTemplate类。您还可以找到这些信息的在这里这篇文章



也许<一个HREF =htt​​ps://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.ui.xaml.controls.datatemplateselector.aspx相对=nofollow> DataTemplateSelector 将帮助你,这里是一些帮助:的 之一,的 3


I created new Windows Phone 8.1 project and when I try to set DataType , vs2013 give me in editor error: The property 'DataType' was not found in type 'DataTemplate'. In WPF application I dont have this problem. How to fix it?

This is my MainPage.xml:

<Page
    x:Class="App6.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:App6"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    <Page.Resources>
        <DataTemplate DataType="{x:Type local:Employee}">
            <TextBlock Text="{Binding Name}" />
        </DataTemplate>
    </Page.Resources>

    <Grid>

    </Grid>
</Page>

解决方案

DataType is not supported in WinRT XAML - see DataTemplate Class. You can also find this information here at this post.

Maybe DataTemplateSelector will help you, here is some help: one, two, three.

这篇关于Windows Phone的应用程序8.1不看的DataTemplate数据类型属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆