You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 1, 2024. It is now read-only.
Please tell me if I'm completely wrong, but shouldn't the method .HasFlag be called on the valueToCheck instead of the referenceEnumValue?
What I mean is, at the moment if the variable I'm binding to is a Flag attribute with values: MyFlagEnum.A | MyFlagEnum.B | MyFlagEnum.C
and I put as TrueValue in the converter MyFlagEnum.B
only, the method call checks if "MyFlagEnum.B" has the flag "MyFlagEnum.A | MyFlagEnum.B | MyFlagEnum.C" which obviously returns false.
As a workaround I wrote a custom EnumToBoolConverter that simply calls the HasFlag() method on the valueToCheck variable instead of the referenceEnumValue
The text was updated successfully, but these errors were encountered:
Description
Please tell me if I'm completely wrong, but shouldn't the method .HasFlag be called on the valueToCheck instead of the referenceEnumValue?
What I mean is, at the moment if the variable I'm binding to is a Flag attribute with values:
MyFlagEnum.A | MyFlagEnum.B | MyFlagEnum.C
and I put as TrueValue in the converter
MyFlagEnum.B
only, the method call checks if "
MyFlagEnum.B
" has the flag "MyFlagEnum.A | MyFlagEnum.B | MyFlagEnum.C
" which obviously returns false.XamarinCommunityToolkit/src/CommunityToolkit/Xamarin.CommunityToolkit/Converters/EnumToBoolConverter.shared.cs
Lines 54 to 55 in 5a6062f
Workaround
As a workaround I wrote a custom EnumToBoolConverter that simply calls the HasFlag() method on the valueToCheck variable instead of the referenceEnumValue
The text was updated successfully, but these errors were encountered: