Question

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?

Was it helpful?

Solution

ActionMessage.ThrowsExceptions = false; will do the trick.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top