更新时间:2022-05-30 02:31:51
鉴于这是WPF(不是Silverlight),我认为您确实可以选择:自定义标记扩展.这样的扩展名可以构造并返回Binding
,但是您会喜欢它,并且将导致一个简单的用法模式,例如:
Given that this is WPF (not Silverlight) I think you do have an option: a custom markup extension. Such an extension could construct and return a Binding
however you like, and would result in a simple usage pattern such as:
<TextBox Text="{ValidatedBinding Description}"/>
有关实现自定义标记扩展的详细信息,请参见此处.
For more information on implementing a custom markup extension, see here.