我正在使用Caliburn Micro作爲Windows Phone應用程序。我有一個超鏈接控件,我想將click事件綁定到View Model。下面是示例代碼Windows Phone Caliburn Micro HyperLink單擊事件
XAML,MyPage.xaml
<TextBlock>
<Run>Got to</Run>
<Hyperlink micro:Message.Attach="[Event Click] = [Action OpenAnotherPage]">
My Page</Hyperlink><Run Text="."></Run></TextBlock>
視圖模型MyPageViewModel.cs
public void OpenAnotherPage()
{
// some code
}
當我的鏈接點擊,我得到一個異常
系統.Exception:沒有找到方法的目標
可能是什麼問題?
更新1:嘗試了超鏈接控制設置micro:Action.TargetWithoutContext="{Binding ElementName=MyPage, Path=DataContext}"
,但沒有奏效
試過了,但得到了同樣的錯誤 –