ValidationError.ErrorContent Proprietà

Definizione

Ottiene o imposta un oggetto che fornisce contesto aggiuntivo per questo ValidationErroroggetto , ad esempio una stringa che descrive l'errore.

public:
 property System::Object ^ ErrorContent { System::Object ^ get(); void set(System::Object ^ value); };
public object ErrorContent { get; set; }
member this.ErrorContent : obj with get, set
Public Property ErrorContent As Object

Valore della proprietà

Oggetto che fornisce contesto aggiuntivo per questo ValidationErroroggetto .

Esempio

Nell'esempio seguente viene illustrato un trigger di stile che crea un oggetto ToolTip che segnala un messaggio di errore di convalida. La Validation.Errors proprietà associata restituisce una raccolta di ValidationError oggetti sull'elemento associato.

<Style x:Key="textStyleTextBox" TargetType="TextBox">
  <Setter Property="Foreground" Value="#333333" />
  <Setter Property="MaxLength" Value="40" />
  <Setter Property="Width" Value="392" />
  <Style.Triggers>
    <Trigger Property="Validation.HasError" Value="true">
      <Setter Property="ToolTip"
        Value="{Binding RelativeSource={RelativeSource Self},
                        Path=(Validation.Errors)[0].ErrorContent}"/>
    </Trigger>
  </Style.Triggers>
</Style>

Commenti

Utilizzo del testo XAML

Per un esempio, vedere la sezione Esempio.

Si applica a