This project is read-only.

Hierarchy message attach with target does not invoke Can+Method under WPF


When attaching a message by using the Action.Target dependency property the Can + MethodName guard is not invoked. I have attached a solution which has two projects. One for silverlight and the exact copy for WPF. The silverlight version works as expected but the WPF version does not work. Under WPF the Can + MethodName gets invoked when using the underscore syntax with x:Name

<!-- Works --> <Button Content="Click Me" cal:Message.Attach="SayHello" cal:Action.Target="{Binding Child.Child}" />

    <!-- Works -->
    <Button Content="Click Me" x:Name="Child_Child_SayHello"/>
    <!-- Does not work -->
    <Button Content="Click Me" cal:Message.Attach="SayHello" cal:Action.Target="{Binding Child.Child}" />

file attachments


EisenbergEffect wrote Apr 20, 2011 at 4:03 PM

If you get a chance to track down where the bug is, please post some info here. I probably won't be able to get to this for a couple of weeks ;( But, if you track it down, and provide a fix, I can get it in there in a day.

LOBOMINATOR wrote Apr 26, 2011 at 4:54 AM

Hy rob
Found out that it is only the first time the binding is not applied. Meaning when you start the application attached to this issue the main difference between SL and WPF is that in SL the Can-Method is invoked for the first time when the "Name" is null therefore when the bindings are applied. The WPF version does only invoke the Can-Method when the binding updates (when you type into the name field). Any ideas where this could be related to?