好的。這個應該很簡單,但我找不到答案。Setter for Pushpin PositionOrigin在Visual Studio和Expression Blend中引發錯誤
This answer顯示瞭如何使用樣式來製作圖釘,設置圖釘的原點。我無法弄清楚下面的代碼有什麼問題。 (XMLNS應正確定義。)
<Style x:Key="OwnLocationStyle"
TargetType="Microsoft_Phone_Controls_Maps:Pushpin">
<Setter Property="Template" Value="{StaticResource OwnLocationTemplate}"/>
<Setter Property="PositionOrigin" Value="BottomCenter"/>
</Style>
此代碼運行在模擬器罰款,但給出了Expression Blend中的錯誤:
The property "PositionOrigin" is not a DependencyProperty. To be used in markup, non-attached properties must be exposed on the target type with an accessible instance property "PositionOrigin". For attached properties, the declaring type must provide static "GetPositionOrigin" and "SetPositionOrigin" methods.
的Visual Studio 2010提供了以下錯誤:對象引用未設置爲一個以藍色強調Property="PositionOrigin"
的對象實例。
怎麼辦?我不明白爲什麼它會編譯&運行並且編輯器會拋出錯誤/警告。