开发者

WPF - Workaround for ValidationRule not being a DependencyObject

What is the best solution for not being able to use data binding on a ValidationRule property since ValiationRule is not a DependencyObject?

Below is an example of what I would like to do. I want to b开发者_运维知识库e able to validate the text in the TextBox against some other DependencyProperty.

<TextBox Name="myTextBox">
    <TextBox.Text>
        <Binding Path="MySource" UpdateSourceTrigger="PropertyChanged">
            <base:EqualsRule Target="{Binding MyTarget}" />
        </Binding>
    </TextBox.Text>
</TextBox>


You could use Josh Smith's virtual branch approach.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜