David Smith

David Smith

  • NA
  • 2k
  • 0

WPF Binding: Triggering a command from another method base u

Jun 3 2015 10:27 AM
At the moment, my databinding working base upon the delegate command when buttonColor
is clicked. However, I want to now disable the buttonColor base upon datagrid.
So if the there are no rows in the datagrid which is databind to a datasource,
disable the buttonColor. If there are rows in the datagrid, Enable the button. Can
someone assist me. I almost have the concept of the MVVM and databinding, just need
somemore experience through a lot of small examples.
private Boolean enableColor { get; set; }
private Delegate isColorEnable { get; set; }
Delegate IsColorEnableCommand { get { return isColorEnable ?? (isColorEnable = new Delegate(IsColorEnableCommandMethod, CanColorBeEnableFromModel)); }set { isColorEnable = value; }}
private void IsColorEnableCommandMethod(){ Do Something}
private void CanColorBeEnableFromModel(Object obj){ Boolean isEnable = (Boolean)obj; return isEnable; }