如何绑定页面属性在Silverlight? [英] How to bind to page property in silverlight?

查看:92
本文介绍了如何绑定页面属性在Silverlight?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个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.

这篇关于如何绑定页面属性在Silverlight?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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