我正在尝试将我子窗口上定义的IsBusy布尔属性连接到silverlight ria services codegen提供的BusyIndicator。
这是繁忙的财产:
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服务收集这些数据。答案 0 :(得分:1)
我需要实现INotifyPropertyChanged,否则它将保持初始元数据值null。