[英]Why Entry on Xamarin.Forms on Windows shows empty even if it contains text until I click it?
我通过后面的代码添加了 Entry,但我在 Android 和 UWP 中没有任何问题。
首先,将当前的cpntentpage stacklayout name 设置为stacklayout1。
<StackLayout x:Name="stacklayout1">
<!-- Place new controls here -->
<Label Text="Welcome to Xamarin.Forms!"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand" />
</StackLayout>
然后在 Stacklayout 中添加 Entry。
Entry txtMeasures = new Entry { WidthRequest = 100, Text = "32", TextColor = Color.Black };
stacklayout1.Children.Add(txtMeasures);
似乎是 UWP 上的条目的一个已知问题:
修复 8503、8787 - 条目中的文本不立即可见,或在 IsVisible 设置为 true 后可见 #8536
有几个变通方法(在条目上设置请求高度,或者它在滚动视图中包裹的地方包含一个 ContentPresenter)。 我遇到了与 scrollView 相关的这个问题,但无法使用任何一种解决方法来工作 🤷♂️
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.