Add StringNullOrEmptyBoolConverter to check when string value is null or empty
This commit is contained in:
parent
060cc48cf4
commit
66ee0039e5
@ -110,6 +110,7 @@
|
||||
<converters:ToUpperConverter x:Key="ToUpperConverter" />
|
||||
<converters:WebNavigatingEventArgsConverter x:Key="WebNavigatingEventArgsConverter" />
|
||||
<converters:WebNavigatedEventArgsConverter x:Key="WebNavigatedEventArgsConverter" />
|
||||
<converters:StringNullOrEmptyBoolConverter x:Key="StringNullOrEmptyBoolConverter" />
|
||||
|
||||
<!-- STYLES -->
|
||||
<Style x:Key="ValidationErrorLabelStyle"
|
||||
|
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace eShopOnContainers.Core.Converters
|
||||
{
|
||||
public class StringNullOrEmptyBoolConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
var stringValue = value as string;
|
||||
|
||||
return !string.IsNullOrEmpty(stringValue);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user