2

フォームにエラー プロバイダーがあり、そのデータ ソースはレコード クラスのエラーのコレクションにバインドされています。

エラー プロバイダー デバッグ ホバー

検証は期待どおりに機能していますが、フォーム コントロールの横に赤い点滅アイコンが表示されません。私のレコードは IDataErrorInfo を実装しています:

    Public ReadOnly Property [Error] As String Implements IDataErrorInfo.Error
        Get
            If _Errors.Count > 0 Then
                Return String.Format("The record cannot be saved because there are {0} errors", _Errors.Count)
            Else
                Return String.Empty
            End If
        End Get
    End Property
    ''' <summary>
    ''' Gets an error message for the property with the given name
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    Default Public ReadOnly Property PropertyError(fieldName As String) As String Implements IDataErrorInfo.Item
        Get
            If _Errors.ContainsKey(fieldName) Then
                Return _Errors(fieldName).ToString
            Else
                Return String.Empty
            End If
        End Get
    End Property

私は完全に立ち往生しているので、どんな考えでも大歓迎です。

4

1 に答える 1

0

この問題は、StaticBalancesOOSRasonValue などのコントロール名を使用してコレクションにエラーを追加し、「StaticBalancesOOSRason」などのプロパティ名を使用して IDataErrorInfo.PropertyError メソッドからエラーを取得しようとしたことが原因で発生しました。これで、アイコンの表示が修正されました。

于 2015-06-18T15:33:00.857 に答える