Replies: 1 comment
-
I've come up with this approach using data triggers: <Grid.Triggers>
<DataTrigger TargetType="Grid" Binding="{Binding Selected}" Value="True">
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource SelectedTabBackgroundColor_Light}, Dark={StaticResource SelectedTabBackgroundColor_Dark}}"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</DataTrigger>
<DataTrigger TargetType="Grid" Binding="{Binding Selected}" Value="False">
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource DefaultTabBackgroundColor_Light}, Dark={StaticResource DefaultTabBackgroundColor_Dark}}"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</DataTrigger>
</Grid.Triggers> I'm not sure if it a recommended approach or if there is a better way but after spending considerable time on it, I don't know about any better really. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Any idea how to achieve this?
The snippet obviously does not work but it shows in pseudo-code what I would like to achieve.
Basically, I would like to have different background color based on two things:
Selected
binding beingtrue
orfalse
Is it possible in MAUI for .NET 8?
Beta Was this translation helpful? Give feedback.
All reactions