Xamarin.forms Xamarin Forms UWP页面在本地计算机上看起来是空白的,但在Windows 10 phone上工作
我用最新的Xamarin.Forms 2.3创建了一个应用程序,并用Lumia 550手机进行了测试 该页面包含一些自定义的Xamarin.forms Xamarin Forms UWP页面在本地计算机上看起来是空白的,但在Windows 10 phone上工作,xamarin.forms,xamarin.uwp,Xamarin.forms,Xamarin.uwp,我用最新的Xamarin.Forms 2.3创建了一个应用程序,并用Lumia 550手机进行了测试 该页面包含一些自定义的条目、一个日期选择器和一个按钮 手机上的应用程序运行得很好,但在本地机器上,我只能看到一个空白屏幕(只有这个页面) 电话: 本地计算机(使用创建者更新升级): 几个月前,他们都与Xamarin合作 更新: 以下是XAML代码: <?xml version="1.0" encoding="utf-8" ?> <ContentView x:Class="M
条目
、一个日期选择器
和一个按钮
手机上的应用程序运行得很好,但在本地机器上,我只能看到一个空白屏幕(只有这个页面)
电话:
本地计算机(使用创建者更新升级):
几个月前,他们都与Xamarin合作
更新:
以下是XAML代码:
<?xml version="1.0" encoding="utf-8" ?>
<ContentView x:Class="MyProject.Views.UserDataView"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:cm="clr-namespace:Caliburn.Micro.Xamarin.Forms;assembly=Caliburn.Micro.Platform.Xamarin.Forms"
xmlns:controls="clr-namespace:XLabs.Forms.Controls;assembly=XLabs.Forms"
xmlns:component="clr-namespace:MyBaseProject.Component;assembly=MyBaseProject"
xmlns:converter="clr-namespace:MyBaseProject.Converter;assembly=MyBaseProject"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Padding="0">
<ContentView.Resources>
<ResourceDictionary>
<converter:BoolConverter x:Key="boolConverter" />
</ResourceDictionary>
</ContentView.Resources>
<ScrollView>
<Grid Padding="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Grid.Row="0"
Style="{DynamicResource BoldField}"
Text="Input1:" />
<component:CustomEntry Grid.Row="1"
Keyboard="Text"
MaxLength="100"
Text="{Binding Param1.Value1}" />
<Label Grid.Row="2" Text="Input2:" />
<DatePicker Grid.Row="3"
Date="{Binding Param1.Value2}"
Format="yyyy.MM.dd"
VerticalOptions="CenterAndExpand" />
<StackLayout Grid.Row="4" Orientation="Horizontal">
<Label x:Name="lblCF"
Style="{DynamicResource BoldField}"
Text="Input3:" />
<Label FontAttributes="Italic"
IsVisible="{Binding Source={x:Reference cfEntry}, Path=IsOK,Converter={StaticResource boolConverter}}}"
Text="(invalid)" />
</StackLayout>
<component:CustomSNEntry x:Name="cfEntry"
Grid.Row="5"
MaxLength="11"
Text="{Binding Param1.Value3}}" />
<Label Grid.Row="6" Text="Input4:" />
<component:CustomEntry Grid.Row="7"
Keyboard="Text"
MaxLength="70"
Text="{Binding Param1.Value4}}" />
<Label Grid.Row="8" Text="Input5:" />
<component:CustomEntry Grid.Row="9"
Keyboard="Text"
MaxLength="70"
Text="{Binding Param1.Value5}" />
<Label Grid.Row="10" Text="Input6:" />
<component:CustomEntry Grid.Row="11"
Keyboard="Text"
MaxLength="10"
Text="{Binding Param1.Value6}" />
<Label Grid.Row="12" Text="Input7:" />
<component:CustomEntry Grid.Row="13"
Keyboard="Text"
MaxLength="100"
Text="{Binding Param1.Value7}" />
<Label Grid.Row="14" Text="Input8:" />
<component:CustomEntry Grid.Row="15"
Keyboard="Telephone"
MaxLength="15"
Text="{Binding Param1.Value8}" />
<Button Grid.Row="16"
cm:Message.Attach="Save"
Style="{DynamicResource BasicButton}"
Text="Save" />
</Grid>
</ScrollView>
</ContentView>
我不知道为什么
如果我移除高度设置器并保留字体大小
,它将不显示任何内容
如果我移除FontSize
设置器并保留高度
,它只显示标签
如果我同时删除这两个项目,它会显示一切正常。您最好发布示例项目以重现问题,或者至少是您的xaml。2.3是最新版本吗?请显示更多详细代码@NicoZhu MSFT请查看我的初始帖子。@Nestor我发现你使用了大量的绑定
和动态资源
。所以我不能用你的段代码重现你的问题。可以共享一个完整的简单项目吗?@NicoZhu MSFT我不能基于这个项目创建一个简单项目,因为它包含受版权保护的代码,任何其他简单项目都不能复制这个问题。是什么导致了手机和电脑之间的这种差异?目标体系结构(x86与ARM)?
<Style ApplyToDerivedTypes="True" TargetType="components:MyEntry">
<Setter Property="FontSize">
<Setter.Value>
<OnIdiom x:TypeArguments="x:Double"
Phone="18"
Tablet="28" />
</Setter.Value>
</Setter>
<Setter Property="HeightRequest">
<Setter.Value>
<OnIdiom x:TypeArguments="x:Double"
Phone="40"
Tablet="50" />
</Setter.Value>
</Setter>
</Style>