maui-linux/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issu.../Issue5003.xaml.cs

47 строки
1.0 KiB
C#

using System;
using System.Globalization;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 5003, "iOS StrikeThrough applied to null string throws error", PlatformAffected.iOS)]
public partial class Issue5003 : ContentPage
{
public Issue5003()
{
#if APP
InitializeComponent();
#endif
BindingContext = new VM();
}
[Preserve(AllMembers = true)]
class VM
{
public string MyNullString { get; set; }
public bool SomeBoolean { get; set; }
}
}
public class StrikeThroughIfTrueConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool b)
{
if (b)
return TextDecorations.Strikethrough;
}
return TextDecorations.None;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}