私はカスタムバリデーターとテキストボックスをいくつか持っています:
( "間違った"データがオブジェクトに返されても(プロパティは文字列です)気にしません。結合は、検証のようなもののための右の場所ではありませんので、もしエラーが教えてくださいがある場合はボタンを押します。私はちょうど私が使用することができますValidation.ErrorTemplateのサポートなど)バリデーションエラーのボタンを無効にする
<ControlTemplate x:Key="validator" >
<DockPanel LastChildFill="True">
<TextBlock DockPanel.Dock="Right" Foreground="Red" FontSize="12pt">!</TextBlock>
<Border BorderBrush="Red" BorderThickness="1.0">
<AdornedElementPlaceholder />
</Border>
</DockPanel>
</ControlTemplate>
<TextBox Height="23" Width="150" TextWrapping="Wrap"
Validation.ErrorTemplate="{StaticResource validator}">
<TextBox.Text>
<Binding Path="StringProperty" UpdateSourceTrigger="LostFocus">
<Binding.ValidationRules>
<local:NumbersOnly/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
どのように私は特定の無効にすることができますいずれかの検証エラーが発生した場合は、ボタンをクリックしますか?
<Button Content="DO Work" Height="57" HorizontalAlignment="Left" Name="button1" VerticalAlignment="Top" Width="234" Click="button1_Click" />
可能な重複こちら:http://stackoverflow.com/questions/231052/using-wpf-validation-rules-and-disabling-a-save - ボタン – Damascus
そこの投稿は質問に答えません... – anderi