WPFUserControlに次のコードがあるとします。にバインドしたいAsset.ChildProperty
。Assetプロパティが変更されたときに通知が届かないため、現在は機能しません。AssetIDが変更されるたびにAssetプロパティの通知がトリガーされるように調整するにはどうすればよいですか?
public static readonly DependencyProperty AssetIdProperty = DependencyProperty.Register("AssetId", typeof(string), typeof(GaugeBaseControl));
[Browsable(false), DataMember]
public string AssetId
{
get { return (string)GetValue(AssetIdProperty); }
set { SetValue(AssetIdProperty, value); }
}
[DisplayName("Asset Item"), Category("Value Binding")]
public AssetViewModel Asset
{
get { return Manager.Models.FirstOrDefault(m => m.Model.UniqueId == AssetId); }
set
{
if (value == null)
AssetId = string.Empty;
else
AssetId = value.Model.UniqueId;
}
}