Open mattleibow opened 1 month ago
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
@mikeparker104 do you have a repro?
This may be a workaround:
public static class IconTintColor
{
public static readonly BindableProperty TintColorProperty =
BindableProperty.CreateAttached("TintColor", typeof(Color), typeof(IconTintColor), default,
propertyChanged: OnTintColorChanged);
private static void OnTintColorChanged(BindableObject bindable, object oldValue, object newValue)
{
if (bindable is not View view)
return;
if (view.Behaviors.OfType<IconTintColorBehavior>().FirstOrDefault() is { } existing)
{
existing.TintColor = (Color)newValue;
}
else
{
var behavior = new IconTintColorBehavior
{
TintColor = (Color)newValue
};
view.Behaviors.Add(behavior);
}
}
public static Thickness GetTintColor(BindableObject view)
{
return (Thickness)view.GetValue(TintColorProperty);
}
public static void SetTintColor (BindableObject view, bool value)
{
view.SetValue(TintColorProperty, value);
}
}
Used like:
<Image
Source="dotnet_bot.png"
HeightRequest="185"
Aspect="AspectFit"
SemanticProperties.Description="dot net bot in a race car number eight"
local:IconTintColor.TintColor="{DynamicResource TargetColor}">
<!-- <Image.Behaviors>
<toolkit:IconTintColorBehavior TintColor="{DynamicResource TargetColor}" />
</Image.Behaviors> -->
</Image>
@mikeparker104 do you have a repro?
@mattleibow adding repro: https://github.com/mikeparker104/repro_23578
Discussed in https://github.com/dotnet/maui/discussions/13691