Reputation: 377
Working with .NET MAUI and simply trying to edit the background color of an Entry. Editing the Styles.xaml and set this:
<Style TargetType="Entry">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
<Setter Property="BackgroundColor" Value="Transparent" />
<Setter Property="FontFamily" Value="OpenSansRegular"/>
<Setter Property="FontSize" Value="14" />
<Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" />
<Setter Property="MinimumHeightRequest" Value="44"/>
<Setter Property="MinimumWidthRequest" Value="44"/>
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="Focused">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="Yellow" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
I am only trying to set the background color of the entry while focused to Yellow which does work BUT when you leave the control it does not revert back to the default color. It retains the yellow background??? Tried setting the normal color which does not work either. In fact if you set a normal color it will override the "focused" setting. I'm new to .NET MAUI so I'm certain I'm missing something!
Thanks in advance
Upvotes: 2
Views: 3243
Reputation: 13853
Yes, it is just the case as you said.
And I have created a new issue about this, you can follow it up here: https://github.com/dotnet/maui/issues/14600.
Thanks for your support for maui and feedback.
Best Regards!
Upvotes: 2