No target found for method in a popup window

Topics: Actions & Coroutines
Jul 4, 2011 at 10:20 PM

Hi at all,
I need to show a popup when the user click a button, this popup contains a list of button that i've implemented with an ItemsControl that looks like this

<ItemsControl x:Name="WardContainer" Margin="5" ItemsSource="{Binding Wards}" HorizontalAlignment="Center" VerticalAlignment="Center">
			<Button Margin="2" Width="70" Height="70" cal:Message.Attach="Choose($dataContext)" Content="{Binding Nome}"/>
			<UniformGrid VerticalAlignment="Center" HorizontalAlignment="Center"/>
 When I show this popup with the windowManager.showDialog() method everything works great but when I use the windowManager.showPopup() method I get the "No target found for method Choose" exception when i click a button of those in the ItemsControl while the other buttons still works well...what's wrong?

Jul 5, 2011 at 12:48 AM

Where does the Choose method live? It's in the same VM containing the "Wards" property?

Jul 5, 2011 at 5:59 AM

Yes it's in the same vm that containing the Wards property

Jul 5, 2011 at 10:47 AM

Can't figure out at a quick glance. I have to investigate it further (later in the afternoon, I hope).
A small repro would greatly help me to dig into it more quickly.

Jul 5, 2011 at 12:07 PM

Here i've uploaded a sample project with the issue i've described.

Jul 5, 2011 at 10:01 PM
Edited Jul 5, 2011 at 10:04 PM

You seem to be hitting a bug in the WindowManager.
The issue is caused by a well known (yet annoying) problem with Popup.
Since Popup spawns a new VisualTree to display its content, CM fails to locate the actual action target when using bubbling actions (that's why other actions works as expected).

I fixed the bug, but I need a little more time to make sure it is not causing any problem, hence I'm going to test it a bit more before commiting it in the repository. 

In the meantime, you can patch your version just adding the higlighted line in WindowManager.ShowPopup method (since you are using the source code version of the framework, it should be very easy):


public virtual void ShowPopup(object rootModel, object context = null, IDictionary<string, object> settings = null) {
  ViewModelBinder.Bind(rootModel, popup, null);
  Action.SetTargetWithoutContext(view, rootModel); // <===



I filed an issue ( so you can get notifications about the fix.

Thank you very much for pointing it out.

Jul 6, 2011 at 6:05 AM

Thank you very much for the help! :)

I will patch my framework

Jul 6, 2011 at 9:11 PM
Edited Jul 6, 2011 at 9:13 PM

The fix was committed in changeset 47de308d08ed (