在App.Resources中使用绑定属性 [英] use binding properties in App.Resources

查看:91
本文介绍了在App.Resources中使用绑定属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我在wpf中有以下要求:

我在App.Resources中定义了样式.
现在,我希望此处的一个控件模板的一个控件与属性结合在一起,该属性在我使用此样式的位置的控件的代码隐藏文件中定义.

Hi all,
I have following requirement in wpf :

I have style defined in App.Resources.
now i want one control of one control template here to bind with property which is defined in codebehind file of control from where i used this style.

so how to bind it?

推荐答案

您可能需要将此样式移动到本地xaml中.如果您仅要为该xaml绑定一个prpoperty,并且此模板随后无法在其他xamls中使用,那么我看不出将其保留在app.xaml文件中的任何意义.
You may need to move this style into your local xaml. IF you are going to bind a prpoperty only for this xaml and this template cannot then be used in other xamls, I dont see any point in keeping it in the app.xaml file.


这篇关于在App.Resources中使用绑定属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆