в Visual Studio для Mac.Вот мой XAML:
<?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="WontSetBackgroundColor">
<ContentView x:Name="subView"/>
</ContentView>
А вот мой код:
using Xamarin.Forms;
namespace MyProject
{
public partial class WontSetBackgroundColor : ContentView
{
public WontSetBackgroundColor()
{
InitializeComponent();
subView.BackgroundColor = Color.Teal;
}
}
}
Окно предварительного просмотра не отображается чирок.Однако, если я установлю цвет фона в XAML, например:
<?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="WontSetBackgroundColor">
<ContentView x:Name="subView" BackgroundColor="Teal"/>
</ContentView>
В окне предварительного просмотра отобразится teal.
Любая помощь?