Closed cris-m closed 11 months ago
The latest version of MauiReactor supports natively behaviors:
[Scaffold(typeof(CommunityToolkit.Maui.Behaviors.IconTintColorBehavior))]
partial class IconTintColorBehavior { }
class BehaviorTestPageState
{
public Color Color { get; set; } = Colors.Red;
}
class BehaviorTestPage : Component<BehaviorTestPageState>
{
public override VisualNode Render()
{
return new ContentPage()
{
new VStack(spacing: 10)
{
new Image("shield.png")
{
new IconTintColorBehavior()
.TintColor(State.Color)
},
new HStack(spacing: 5)
{
new Button(nameof(Colors.Red), () => SetState(s => s.Color = Colors.Red)),
new Button(nameof(Colors.Green), () => SetState(s => s.Color = Colors.Green)),
new Button(nameof(Colors.Black), () => SetState(s => s.Color = Colors.Black)),
}
.HCenter()
}
.Center()
};
}
}
I would like to know if there is a ways to use
Behavior
. Like to change color ofsvg
image usingIconTintColorBehavior
of.NET MAUI Community Toolkit
Originally posted by @cris-m in https://github.com/adospace/reactorui-maui/issues/14#issuecomment-1793655239