我可以将一个
示例: 绑定:
Binding
定义为 Resource
,然后将其用于不同的 Controls
属性中吗?示例: 绑定:
<Window.Resources>
<Binding x:Key="MyBinding" Path="MyProperty" Mode="TwoWay" />
</Window.Resources>
XAML 中的重用:
<TextBox Text="{StaticResource MyBinding}" />
在以上声明Binding
后,我收到了以下错误信息:
"The name 'InitializeComponent' does not exist in the current context"
是否有办法在不同的上下文中重复使用相同的Binding
?