The StackLayout in my ControlTemplage:
<StackLayout Grid.Row="0" Grid.Column="0" Style="{StaticResource NavigationBarLayoutStyle}" BackgroundColor="TemplateBinding Parent.HomeBackgroundColor"> ...... </StackLayout>
I want to change its background color in the behind code of Home page by using a bindable property
public static readonly BindableProperty HomeBackgroundColorProperty = BindableProperty.Create("HomeBackgroundColor", typeof(Color), typeof(HomePage), Color.Red); public Color HomeBackgroundColor { get { return (Color)GetValue(HomeBackgroundColorProperty); } }
The error message is
System.InvalidOperationException: Cannot convert "TemplateBinding Parent.HomeBackgroundColor" into Xamarin.Forms.Color
The same way works very well for Label.Text property but the background color. Thanks for your help