Xamarin.forms Windows通用项目中不支持条目和选择器

Xamarin.forms Windows通用项目中不支持条目和选择器,xamarin.forms,Xamarin.forms,我已经创建了一个Xamarin.Forms解决方案(最新版本的Xamarin和VS 2017 CE),并且我有针对Android、iOS和UWP的项目 我已经在共享项目中创建了一个用户控件,并尝试向其中添加一个条目和一个选取器控件,但我收到一个编译错误,该错误表示“Windows通用项目中不支持条目”和“Windows通用项目中不支持选取器”。我在任何文档中都找不到这些控件与UWP不兼容的迹象,我还发现了一些例子,其中人们似乎在UWP项目中非常愉快地使用这些控件 我错过什么了吗?如果无法使用这些

我已经创建了一个Xamarin.Forms解决方案(最新版本的Xamarin和VS 2017 CE),并且我有针对Android、iOS和UWP的项目

我已经在共享项目中创建了一个用户控件,并尝试向其中添加一个条目和一个选取器控件,但我收到一个编译错误,该错误表示“Windows通用项目中不支持条目”和“Windows通用项目中不支持选取器”。我在任何文档中都找不到这些控件与UWP不兼容的迹象,我还发现了一些例子,其中人们似乎在UWP项目中非常愉快地使用这些控件

我错过什么了吗?如果无法使用这些控件,那么Xamarin.Forms的意义是什么?我认为这是为了避免为每个平台创建完全不同的UI

此外,我的用户控件位于名称空间MyApp.Views中,xaml自动生成行“xmlns:local=“using:MyApp.Views”。这还会生成一个编译错误:“未定义的命名空间。“正在使用”URI引用了找不到的命名空间“MyApp.Views”。”。这是自动生成的,后面的代码显然在这个名称空间中,所以我也不清楚这是关于什么的

<UserControl
    x:Class="MyApp.Views.SomeControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:MyApp.Views"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="64"
    d:DesignWidth="400">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Picker x:Name="demographics" Grid.Row="0" Grid.Column="0"></Picker>
        <Entry x:Name="filter" Grid.Row="0" Grid.Column="1"></Entry>
    </Grid>
</UserControl>

请注意,UWP用户控件的Xamarin表单版本是ContentView

在“MyApp”项目中创建Xamarin表单控件,而不是在“MyApp.UWP”项目中创建;例如:

<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms" 
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         x:Class="MyApp.MyContentView">
  <ContentView.Content>
    <Entry />
  </ContentView.Content>
</ContentView>

请注意,UWP用户控件的Xamarin表单版本是ContentView

在“MyApp”项目中创建Xamarin表单控件,而不是在“MyApp.UWP”项目中创建;例如:

<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms" 
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         x:Class="MyApp.MyContentView">
  <ContentView.Content>
    <Entry />
  </ContentView.Content>
</ContentView>

这是IDE中的错误、编译错误还是运行时错误?您的用户控件是否在共享项目中?这是一个编译错误。用户控件位于共享项目中。请发布相关代码和特定错误消息我在帖子中发布了确切的错误消息。xaml只是基本的,等等。您正在尝试将XF xaml与UWP用户控件混合使用。这不是它的工作方式这是IDE中的错误、编译错误还是运行时错误?您的用户控件是否在共享项目中?这是一个编译错误。用户控件位于共享项目中。请发布相关代码和特定错误消息我在帖子中发布了确切的错误消息。xaml只是基本的,等等。您正在尝试将XF xaml与UWP用户控件混合使用。这不是它的工作原理