代码之家  ›  专栏  ›  技术社区  ›  Sprague

DependencyProperty未更新BusyIndicator

  •  0
  • Sprague  · 技术社区  · 14 年前

    我正在尝试将子窗口上定义的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属性。

    顺便说一句,对于任何建议我绑定到DataSourceIsBusy属性的人,我都是通过连接到ERP系统的Web服务收集这些数据的。

    1 回复  |  直到 14 年前
        1
  •  1
  •   Sprague    14 年前

    我需要实现inotifyPropertyChanged,否则它将保持在初始元数据值为空。