J
J
Jaguar_sea2014-10-24 06:52:20
C++ / C#
Jaguar_sea, 2014-10-24 06:52:20

How to correctly validate CurrentEntity in a dialog box?

I'm passing a user-selected row from a DataGrid to a dialog box. I write it in:

private ServiceCenter _serviceCenter;
public ServiceCenter _ServiceCenter
{
    get { return _serviceCenter; }
    set
    {
    if (_serviceCenter == value) { return; }
    _serviceCenter = value;
    RaisePropertyChanged(() => _ServiceCenter);
    }
}

ViewModel - and this dialog box.
I display in the window as follows:
<TextBox Text="{Binding _ServiceCenter.FullName, 
                            ValidatesOnDataErrors=True,
                            UpdateSourceTrigger=PropertyChanged}" />

Also in the ViewModel of the dialog box, the IDataErrorInfo interface is implemented.
In theory, when changing field values, the data should fall into the implemented IDataErrorInfo interface meta, but for some reason this does not happen. Please tell me what I'm doing wrong. public string this[string columnName]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Teacher, 2014-10-30
@Teacher

Good afternoon.
See an example on data validation here .
If you have any questions, write, I will try to explain.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question