如何绑定页面属性在Silverlight?绑定、属性、页面、Silverlight

2023-09-04 04:43:46 作者:回不到最初看不到未来

我有一个Silverlight页面,在codebehind布尔属性。

I have a silverlight page with a boolean property in the codebehind.

在XAML我有一个TabControl的和内部的TabItem的内容之一是BusyIndi​​cator控件。

In the xaml I have a tabcontrol and inside one of the tabitem's content is a busyindicator.

我想将BusyIndi​​cator控件的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.

 
精彩推荐
图片推荐