在我的 WPF 应用程序中,我使用以下 xaml:...
<TextBox
services:TextBoxService.IsFocused="{Binding Path=IsSelected, Mode=OneWay}"
FocusVisualStyle="{x:Null}">
<MultiBinding
Converter="{StaticResource mconv_operableToString}"
UpdateSourceTrigger="PropertyChanged">
<Binding
Path="Value"
Mode="TwoWay"
NotifyOnValidationError="True" />
<Binding
RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type UserControl}}"
Path="DataContext.Status"
Mode="OneWay" />
</MultiBinding>
第一个绑定使用的视图模型类实现 IDataErrorInfo 以进行验证。问题是,虽然错误在属性设置器中被捕获,但 UI 并没有注意到它。我有一个用错误模板定义的样式,当文本框中发生任何错误时应该应用该样式。我想也许这种情况在多重绑定中是不允许的,因为在我使用单一绑定的地方一切正常。
提前致谢。