39 строки
1.2 KiB
C#
39 строки
1.2 KiB
C#
#region Copyright Syncfusion Inc. 2001-2024.
|
|
// Copyright Syncfusion Inc. 2001-2024. All rights reserved.
|
|
// Use of this code is subject to the terms of our license.
|
|
// A copy of the current license can be obtained at any time by e-mailing
|
|
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
|
// applicable laws.
|
|
#endregion
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
|
|
namespace syncfusion.layoutdemos.wpf.Converter
|
|
{
|
|
public class ErrorConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
var validationErrors = value as ReadOnlyObservableCollection<ValidationError>;
|
|
if (validationErrors.Count > 0)
|
|
{
|
|
return validationErrors[0].ErrorContent;
|
|
}
|
|
|
|
return string.Empty;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
return string.Empty;
|
|
}
|
|
}
|
|
}
|