我有一個故事板並希望設置附加屬性VisualStateUtility.InitialState。我嘗試過各種組合,但屬性永遠不會解決。在StoryBoard上設置自定義附加屬性
我得到以下錯誤:無法解析TargetProperty(VisualStateUtility.InitialState)
我如何設置情節提要我的自定義附加屬性的值?
<ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="(Fully.Qualified.Namespace.VisualStateUtility.InitialState)" Storyboard.TargetName="ExpanderButton">
public static string GetInitialState(DependencyObject obj)
{
return (string)obj.GetValue(InitialStateProperty);
}
public static void SetInitialState(DependencyObject obj, string value)
{
obj.SetValue(InitialStateProperty, value);
}
// Using a DependencyProperty as the backing store for InitialState. This enables animation, styling, binding, etc...
public static readonly DependencyProperty InitialStateProperty =
DependencyProperty.RegisterAttached("InitialState", typeof(string), typeof(VisualStateUtility), new PropertyMetadata(null,OnInitialStatePropertyChanged));
你能提供你附屬物的聲明嗎?您不會通過TargetProperty中的完全限定名稱來引用它,因爲這些點只是指子成員,而不是名稱空間。只是短版「InitialState」。 –
...並且當您確實添加了12小時前所做的更改時,請確保您添加了後續評論,以便我們實際注意到:) –
+1提供了代碼。使它更容易看到出了什麼問題:) –