2010-08-23 154 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的初始元數據值。

相關問題