tags:

views:

75

answers:

1

I am new to WPF and tring to learn a WPF composite application.
I have got user control which is a module which 1 label and 1 button on it.
Now I am trying to use the Command property on button which looks like

<Button Name="button1" Command="{Binding Path = GetCustomerNameCommand}">GetCustomer</Button>

In the presenter I have got

public class HelloWorldPresenter : PresenterBase<IHelloWorldView>
    {
        private readonly IWpfService _wpfService;

        public HelloWorldViewModel CustomerViewModel { get; set; }

        public ICommand GetCustomerNameCommand { get; set; }

        public HelloWorldPresenter(IHelloWorldView view, IWpfService wpfService)
            : base(view)
        {
            _wpfService = wpfService;

            GetCustomerNameCommand = new DelegateCommand<string>(GetCustomerName);
            View.Presenter = this;

            PopulateViewModel(string.Empty);
        }

        private void GetCustomerName(string obj)
        {
            throw new NotImplementedException();
        }

        private void PopulateViewModel(string test)
        {
            CustomerViewModel = new HelloWorldViewModel { Name = _wpfService.GetCustomer() };
        }
    }

The thing is GetCustomerName() method is not getting executed when i click the Button

A: 

I found it, i was adding the same view 2 times which was creating the problem...

Miral