<Window.Resources> <my:IsIntegerRule x:Key="IsIntegerRule"/></Window.Resources>......<TextBox> <TextBox.Text> <Binding XPath="@num" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay"> <Binding.ValIDationRules> <-- WHAT IS THE EQUIVALENT OF WRITING: {StaticResource IsIntegerRule} here --> </Binding.ValIDationRules> </Binding> </TextBox.Text> </TextBox>
有人可以帮忙吗?
解决方法 您可以使用常规属性元素语法进行标记扩展.见 Markup Extensions and WPF XAML.它看起来像这样:<Binding.ValIDationRules> <StaticResource ResourceKey="IsIntegerRule"/></Binding.ValIDationRules>总结
以上是内存溢出为你收集整理的wpf – XAML:请参阅普通XAML中的StaticResource? (没有标记扩展名)全部内容,希望文章能够帮你解决wpf – XAML:请参阅普通XAML中的StaticResource? (没有标记扩展名)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)