たDependencyPropertyを見つけるために名前を使用します。
このような要望がある場合は、DependencyPropertyDescriptorに目を通すために必要とされます。
一般的に追加の属性または属性に依存した方法を使用します。
次の例では、追加のプロパティを与えます:
追加のプロパティは、あなたが探しているプロパティを入力する文字列を使用して、登録されています
パブリック 静的 読み取り専用たDependencyProperty AniInvokeParameterProperty = DependencyProperty.RegisterAttached(" AniInvokeParameter "、typeof演算(文字列)、typeof演算(AniInvoke))。 パブリック 静的 ボイド SetAniInvokeParameter(のDependencyObject D、文字列値)=> d.SetValue(AniInvokeParameterProperty、値)。 パブリック 静的 文字列 GetAniInvokeParameter(のDependencyObjectのD)=>(文字列)d.GetValue(AniInvokeParameterProperty)。
特定DependencyPropertyDescriptorを使用してください
公共の 静的な 読み取り専用のDependencyProperty AniInvokePropery = DependencyProperty.RegisterAttached(" AniInvoke "、typeof演算(AnimationTimeline)、typeof演算(AniInvoke)、新しい PropertyMetadata(ヌル、AniInvokeCallBack)); パブリック 静的 ボイド SetAniInvoke(のDependencyObjectのD、AnimationTimeline値)=> d.SetValue(AniInvokePropery、値)。 パブリック 静的 AnimationTimeline GetAniInvoke(のDependencyObjectのD)=> (AnimationTimeline)d.GetValue(AniInvokePropery)。 プライベート 静的 無効AniInvokeCallBack(のDependencyObjectのD、DependencyPropertyChangedEventArgs E) { VARの T = D などのFrameworkElement。 VAR dpName = t.GetValue(AniInvokeParameterProperty)として 文字列; もし(!文字列.IsNullOrWhiteSpace(dpName)) { VAR DPD = DependencyPropertyDescriptor.FromName(dpName、t.GetType()、t.GetType()); VaRのプロパティ= dpd.DependencyProperty。 VaRの ANI = (AnimationTimeline)e.NewValue。 もし(プロパティ!= nullの && ANI!= nullの) t.BeginAnimation(プロパティ、ANI)。 } }