I have a set of items, let's say Person:
public class Person : INotifyPropertyChanged, INotifyDataErrorInfo
{
private string name;
public string Name
{
get { return name; }
set
{
name = value;
RaisePropertyChanged("Name");
Validate("Name");
}
}
private int age;
public int Age
{
get { return age; }
set
{
age= value;
RaisePropertyChanged("Age");
Validate("Age");
}
}
}
I managed to get the validation working, however I don't know how to display the item's Error when user inputs figure 18 and below as the tooltip because the tooltip shows the viewmodel's errors instead. How can I get the datagridcell tooltip to instead show error of the Person object instead?
Here's the Datagrid code:
<DataGrid ItemsSource="{Binding PersonsList, Mode=TwoWay, UpdateSourceProperty=PropertyChanged}", AutoGenerateColumns="False">
<DataGridTextColumn Header="Name" Text="{Binding Name, Mode=TwoWay, UpdateSourceProperty=PropertyChanged, ValidatesOnNotifyDataErrors=True}" />
<DataGridTextColumn Header="Age" Text="{Binding Age, Mode=TwoWay, UpdateSourceProperty=PropertyChanged, ValidatesOnNotifyDataErrors=True}" />
</Datagrid>
What I have tried:
I Have no idea what to do here