Constraints with conventions binding using nested properties

Topics: Conventions
Jul 8, 2011 at 8:56 PM

I am trying to setup a button using the x:Name="SomeViewModel_SomeMethod" convention in a ChildView.

    public class MainViewModel : Screen
    {
        public bool CanSomeMethod{get { return false; }}
        public void SomeMethod(){return;}
    }

    public class OtherViewModel : Screen
    {
        private MainViewModel _someViewModel = new MainViewModel();
        public MainViewModel SomeViewModel { get { return _someViewModel; } }

        public bool CanLocalMethod{get { return false; }}
        public void SomeLocalMethod(){return;}
 
public bool CanSomeMethod{get { return SomeViewModel.CanSomeMethod; }} public void SomeMethod(){SomeViewModel.SomeMethod();}

 }

in my OtherView:

<Button x:Name="SomeViewModel_SomeMethod" Width=40>TestButton </Button>   is not being setup

<Button x:Name="SomeLocalMethod" Width=40>TestButton2 </Button>   is being setup correctly.

<Button x:Name="SomeMethod" Width=40>TestButton3 </Button>   is being setup correctly.

How can I debug this?

It isn't quite a simple as this as there are conductors etc but I thought this was pretty straight forward and I know I'm doing it elsewhere with Model_SomeValue where Model is a BO...

thanks

jack

 

Coordinator
Jul 8, 2011 at 9:10 PM

You can't actually bind to methods that way. The "deep" binding doesn't work for actions.

Jul 8, 2011 at 11:08 PM

Rob,

Thanks for confirming so quickly.

Is that something that could be added without much difficulty? If it works for standard databinding convention should it be that hard for actions?

Jack

From: EisenbergEffect [email removed]
Sent: Friday, July 08, 2011 3:11 PM
To: jaddington@alexandergracie.com
Subject: Re: Constraints with conventions binding using nested properties [caliburnmicro:264470]

From: EisenbergEffect

You can't actually bind to methods that way. The "deep" binding doesn't work for actions.