【问题标题】:DependencyProperty not updating BusyIndicatorDependencyProperty 不更新 BusyIndi​​cator
【发布时间】:2011-04-02 17:16:18
【问题描述】:

我正在尝试将在我的子窗口上定义的 IsBusy 布尔属性连接到 silverlight ria services codegen 提供的 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 服务收集这些数据。

【问题讨论】:

    标签: c# xaml silverlight-4.0


    【解决方案1】:

    我需要实现 INotifyPropertyChanged,否则它会停留在初始元数据值 null。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-05-19
      • 1970-01-01
      • 2012-09-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-17
      • 2012-11-28
      相关资源
      最近更新 更多