2010-08-23 34 views
0

我试图将我的子窗口上定义的IsBusy布尔属性连接到由silverlight ria服务代码提供的BusyIndi​​cator。DependencyProperty不更新BusyIndi​​cator

这里是忙碌的属性:

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服务收集此数据。

回答

1

我需要实现INotifyPropertyChanged,否则它保持在null的初始元数据值。

相关问题