如何绑定页面属性在Silverlight? [英] How to bind to page property in silverlight?
问题描述
我有一个Silverlight页面,在codebehind布尔属性。
I have a silverlight page with a boolean property in the codebehind.
在XAML我有一个TabControl的和内部的TabItem的内容之一是BusyIndicator控件。
In the xaml I have a tabcontrol and inside one of the tabitem's content is a busyindicator.
我想将BusyIndicator控件的isbusy属性绑定到在codebehind布尔属性,但我不解决这个问题,无论我用什么约束力的声明。
I want to bind the busyindicator's isbusy property to the boolean property in the codebehind, but I can't resolve it no matter what binding statement I use.
推荐答案
在codebehind,你需要确保你已经设置的DataContext。因此,在你页面的Load事件,把这个:
In the codebehind, you need to make sure you have set the DataContext. So in the Load event of your page, put this:
this.DataContext = this;
如果你已经做到了这一点,那么你将需要发布更多的细节。
If you have already done this then you will need to post more details.
这篇关于如何绑定页面属性在Silverlight?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!