I can't compile and Visual Studio tell me this:
Cannot convert value"BackgroundColor" to "Xamarin.Forms.BindableProperty".(XFC0040)
My code is the next:
<Style x:Key="BaseButton" TargetType="{x:Type buttons:SfButton}">
<Setter Property="TextColor" Value=#F1F1F1" />
<Setter Property="BackgroundColor" Value="#F5AF27" />
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="#F5AF27" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="#33F5AF27" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
I'm doing something wrong or may be is a bug?
Hi Asier,
Query: Cannot compile Style when TargetType is defined as {x:Type buttons:SfButton} instead of buttons:SfButton
Thank you for contacting Syncfusion Support.
Style cannot be compiled in {x:Type buttons:SfButton} because x:Type is used to set attribute System.Type object. And also similar error issue occured in Button control. So kindly use the control explicitly like buttons: SfButton to apply style.
We have attached a sample for your reference. Kindly refer to the sample and please let us know if you need any other details.
Regards,
Shivani
Thank you for your response. I wanted to use {x:Type xxx} because I thought that it was the better way to do it because I believed that it was more detailed for the compiler.
If it's not too much to ask, could you pass me any page where explain diferences between use a Type or directly the control for the Style?
Thanks a lot.
Hi Asier,
Please find the below link, which explains the nature of x:Type and its string type property.
Differences- https://stackoverflow.com/questions/11167536/when-to-use-xtype-for-style-targettype
Thanks a lot for your clarify response.
Hi Asier,
We are glad that the workaround we offered was successful for you. We will be closing this forum thread, if you require any further information, please open a new one.
Regards,
Vijayakumar V