0

How to use relay command in set, I use the following way, throws interface bug on set method

     public RelayCommand ChartCommand
    {

        set
        {
            ChartCommand = new RelayCommand<string>(e => ExecuteChartCommand(e));

        }
    }
    public void ExecuteChartCommand(string vendor)
    {

    }

1 Answers1

2

You should really be doing it this way:

    private RelayCommand<string> m_ChartCommand;
    public RelayCommand<string> ChartCommand
    {    
        get
        {
            return m_ChartCommand ?? (m_ChartCommand = new RelayCommand<string>(e => ExecuteChartCommand(e));    
        }
    }

    public void ExecuteChartCommand(string vendor)
    {

    }

.

Louis Kottmann
  • 16,268
  • 4
  • 64
  • 88