Answers for "c# binding button"

C#
0

binding on button c#

<Button Command="{Binding Path=SaveCommand}" />
Posted by: Guest on July-11-2021
0

binding on button c#

public MyCustomClass
{
    private ICommand _saveCommand;

    public ICommand SaveCommand
    {
        get
        {
            if (_saveCommand == null)
            {
                _saveCommand = new RelayCommand(
                    param => this.SaveObject(), 
                    param => this.CanSave()
                );
            }
            return _saveCommand;
        }
    }

    private bool CanSave()
    {
        // Verify command can be executed here
    }

    private void SaveObject()
    {
        // Save command execution logic
    }
}
Posted by: Guest on July-11-2021

C# Answers by Framework

Browse Popular Code Answers by Language