문제

I have a style in my xaml-resources. It looks like this:

<Border cm:Message.Attach="[Event Tapped] = [Action UserCardTapped($dataContext)]">
 ...
</Border>

So I use this style in the different pages and different viewModels, but not all viewModels need to implement a method UserCardTapped. And here is the problem - if my viewModel doesn't contain a UserCardTapped method, Caliburn throws an exception with a message "No target found for method UserCardTapped".

Is it possible to disable binding to the method if it doesn't exist?


Why down-voting? Is there more elegant way?

도움이 되었습니까?

해결책

ActionMessage.ThrowsExceptions = false; will do the trick.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top