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
As discussed in Discord with @Cheesebaron regarding re-triggering value converters in Fluent bindings, I've tried using a Tibet binding instead with AttributedText and got very strange results. Instead of getting my attributed string as returned in my value converter with the correct text, it gets returned with { postfixed.
Also spans are not working anymore as in my value converter, I possibly return an attributed string with the original text, or an attributed string with a * prefixed and a foreground color span on that character. The text that shows is then *{ in all black instead of * Behaald diploma with the * in red for example.
With Fluent binding, I just get * Behaald diploma with the * in red as expected.
Expected behavior
Tibet binding returns the correct attributed string.
Reproduction steps
public class RequiredAttributedStringValueConverter : MvxValueConverter<string, NSMutableAttributedString>
{
protected override NSMutableAttributedString Convert(string value, Type targetType, object parameter,
CultureInfo culture)
{
var required = (bool?)parameter;
var mutableString = new NSMutableAttributedString(value);
if (required.HasValue && !required.Value)
{
return mutableString;
}
value = $"* {value}";
mutableString = new NSMutableAttributedString(value);
mutableString.AddAttribute(UIStringAttributeKey.ForegroundColor, Colors.Red.ToPlatformColor(),
new NSRange(0, 1));
return mutableString;
}
}
Digifais
changed the title
Using Tibet binding on a iOS UILabel AttributedText property gives weird results in comparison to Fluent binding.
Using Tibet binding on a iOS UILabel AttributedText property gives weird results in comparison to Fluent binding
Jan 17, 2024
馃悰 Bug Report
As discussed in Discord with @Cheesebaron regarding re-triggering value converters in Fluent bindings, I've tried using a Tibet binding instead with AttributedText and got very strange results. Instead of getting my attributed string as returned in my value converter with the correct text, it gets returned with
{
postfixed.Also spans are not working anymore as in my value converter, I possibly return an attributed string with the original text, or an attributed string with a
*
prefixed and a foreground color span on that character. The text that shows is then*{
in all black instead of* Behaald diploma
with the*
in red for example.With Fluent binding, I just get
* Behaald diploma
with the*
in red as expected.Expected behavior
Tibet binding returns the correct attributed string.
Reproduction steps
Fluent binding:
set.Bind(_lblEducationYear).For(v => v.AttributedText).To(model => model.LblEducationYear).WithConversion<RequiredAttributedStringValueConverter>(((OnboardingEducationInputListItem)DataContext).ShouldValidateFields)
Tibet binding:
set.Bind(_lblEducationName, "AttributedText RequiredAttributedString(LblEducationName, ShouldValidateFields)")
Configuration
Version: 8.0.2 (can't migrate yet since project is still not on .NET)
Platform:
The text was updated successfully, but these errors were encountered: