如何在XAML的Xamarin.Forms中的Visual Studio中设置十六进制BackgroundColor和整数FontSize? [英] How to set a hex BackgroundColor and integer FontSize in Visual Studio in Xamarin.Forms in XAML?
问题描述
我的问题是我在 Visual Studio 中遇到有关 BackgroundColor
和 fontSize $ c $的错误c>按钮上的属性。
没有Visual Studio错误的所需XAML:
< Button Text = / Grid.Row = 1 Grid.Column = 3
BackgroundColor =#FFA500 TextColor = White
FontSize = 36 BorderRadius = 0 />
Visual Studio错误:
但是,XAML文档将十六进制颜色设置为背景颜色,所以应该没有错误吧?:
为Visual Studio 2017 15.8版安装IDE兼容性解决了此问题:
我所做的破坏了临时解决方案的操作
我清理并构建了公共类库和平台库。我还删除了iOS和Windows手机库。这些步骤导致以下错误:
对我有用的东西
我决定创建一个新的解决方案,并接受了 FontSize = 36 我的XAML文件中的code>和
BackgroundColor =#808080
。我以前使用的解决方案来自一个网站。
几天后,我又遇到了另一个错误
为Visual Studio 2017 15.8版安装IDE兼容性解决了此问题: https://releases.xamarin.com/category/visual-studio-tools-for-xamarin/
My problem is that I am facing errors in Visual Studio about the BackgroundColor
and fontSize
property on my buttons.
Desired XAML without Visual Studio errors:
<Button Text="/" Grid.Row="1" Grid.Column="3"
BackgroundColor="#FFA500" TextColor="White"
FontSize="36" BorderRadius="0" />
The Visual Studio errors:
However, the XAML documentation sets a hex color as background color so there shouldn't be an error right?:
https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/colors#using-from-xaml
Short version:
I created a new solution and it accepts the
FontSize="36"
andBackgroundColor="#808080"
. The solution I previously used came from a website.A few days later I got another error
Installing the IDE compatibility for Visual Studio 2017 version 15.8 solved this: https://releases.xamarin.com/category/visual-studio-tools-for-xamarin/
Long version:
My temporary solution
I just set my error list to build only so I can compile my code anyway.
IntelliSense seems to generate the errors, but the hex colors and font size I declared in my XAML are working.
What I did that broke my temporary solution
I cleaned and build the public class library and the platform libraries. I also deleted the iOS and Windows phone library. These steps resulted in the errors below:
What worked for me
I decided to create a new solution and it accepted the FontSize="36"
and BackgroundColor="#808080"
in my XAML file. The solution I previously used came from a website.
A few days later I got another error
Installing the IDE compatibility for Visual Studio 2017 version 15.8 solved this: https://releases.xamarin.com/category/visual-studio-tools-for-xamarin/
这篇关于如何在XAML的Xamarin.Forms中的Visual Studio中设置十六进制BackgroundColor和整数FontSize?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!