Binding.ValidationRules Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a collection of rules that check the validity of the user input.
public:
property System::Collections::ObjectModel::Collection<System::Windows::Controls::ValidationRule ^> ^ ValidationRules { System::Collections::ObjectModel::Collection<System::Windows::Controls::ValidationRule ^> ^ get(); };
public System.Collections.ObjectModel.Collection<System.Windows.Controls.ValidationRule> ValidationRules { get; }
member this.ValidationRules : System.Collections.ObjectModel.Collection<System.Windows.Controls.ValidationRule>
Public ReadOnly Property ValidationRules As Collection(Of ValidationRule)
Property Value
A collection of ValidationRule objects.
Remarks
The WPF data binding model enables you to associate ValidationRules with your Binding or MultiBinding object. You can create custom rules by deriving from the ValidationRule class and implementing the Validate method, or you can use the built-in ExceptionValidationRule, which invalidates a value if there are exceptions during source updates.
The binding engine checks each ValidationRule associated with a binding each time an input value (the binding target property value) is transferred to the binding source property. For a detailed discussion of the validation process, see the Data Validation section in the Data Binding Overview.
Note
This property can be set in Extensible Application Markup Language (XAML) only by using the collection syntax shown, or by accessing the collection object and using its various methods, such as Add
. The property to access the collection object is read-only, whereas the collection itself is read-write.
XAML Property Element Usage
<object>
<object.ValidationRules>
oneOrMoreValidationRules
</object.ValidationRules>
</object>
XAML Values
oneOrMoreValidationRules
One or more ValidationRule objects. You can use the ExceptionValidationRule class or create custom rules by subclassing the ValidationRule class.
Applies to
See also
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기