検証ルールを textBox に追加したかったのですが、問題は、次のコードを実行すると、次のエラー メッセージが表示されることです。
タイプ 'myValidations' の値は、タイプ 'Collection`1' のコレクションまたはディクショナリに追加できません。
クラス myValidations ロールがアクティブです。
何が問題になる可能性がありますか?
<TextBox x:Name="Name" Grid.Column="4" Margin="0,50,0,0" Grid.Row="2" Style="{StaticResource tooltipError}">
<Binding ElementName="textBlock" Path="Text">
<Binding.ValidationRules>
<viewModel:MyValidationsRules/>
</Binding.ValidationRules>
</Binding>
</TextBox>
テキスト ボックスは、次のスタイルから継承されます。
<Style TargetType="TextBox">
<Setter Property="AcceptsReturn" Value="True"/>
<Setter Property="AllowDrop" Value="True"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="Height" Value="44"/>
<Setter Property="Width" Value="199"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<EventSetter Event="PreviewDragEnter"
Handler="DropText_PreviewDragEnter"/>
<EventSetter Event="PreviewDrop"
Handler="DropText_PreviewDrop"/>
<EventSetter Event="PreviewDragOver"
</Style>