help me please
After starting the application, the textbox does not give any error
Class
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ComponentModel; namespace WpfApplication2 { class Class1 : IDataErrorInfo { public string Name { get; set; } public string Error { get { return null; } } public string this[string columnName] { get { switch (columnName) { case "Name": if (string.IsNullOrEmpty(this.Name)) return "Name can't be empty."; break; } return string.Empty; } } } }
XAML
<Window x:Class="WpfApplication2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <TextBox HorizontalAlignment="Left" Height="23" Margin="201,114,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120" Text="{Binding Path=Name, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}" /> </Grid>
Application window
DataContext
? - VladD