我正在尝试将我的子窗口上定义的IsBusy布尔型属性连接到silverlight ria services codegen提供的BusyIndicator。
下面是busy属性:
public bool IsBusy
{
get { return (bool)this.GetValue(IsBusyProperty); }
set { this.SetValue(IsBusyProperty, value); }
}
public static readonly DependencyProperty IsBusyProperty = DependencyProperty.Register(
"IsBusy", typeof(bool), typeof(FindPlant), new PropertyMetadata(false));下面是它在XAML中的用法
<controls:ChildWindow xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
xmlns:my="clr-namespace:Locators.Controls"
x:Class="Locators.Views.FindPlant"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
Width="500" Height="600"
Title="Choose a plant...">
<my:BusyIndicator x:Name="LoadingIndicator" IsBusy="{Binding Path=IsBusy}" >
<!--... content omitted ...-->
</my:BusyIndicator>
</controls:ChildWindow>我的第二个想法是我没有正确地注册DependencyProperty。有人能对此发表评论吗?我正在寻找一种最普通的、未扩展的XAML方法来处理这个问题。
我使用SetValue为IsBusy属性赋值。
顺便说一句,对于任何建议我绑定到数据源IsBusy属性的人,我正在通过连接到ERP系统的web服务来收集这些数据。
发布于 2010-11-17 04:09:07
我需要实现INotifyPropertyChanged,否则它将停留在初始元数据值null。
https://stackoverflow.com/questions/3549053
复制相似问题