c# - How do I get the CanXXX behavior for drop down selection in Caliburn.Micro? -


if have button named execute, can write method control button's clickability:

public bool canexecute() {     return !string.isnullorwhitespace(this.selectedcatalogname) && !string.isnullorwhitespace(this.selectedcommandname); } 

similarly, have dropdown named selectedcommand should disabled until dropdown selected:

private bindablecollection<string> catalognames; public bindablecollection<string> catalognames {         {         return this.catalognames;     } }  private string selectedcatalog; public string selectedcatalogname {         {         return this.selectedcatalog;     }     set     {         this.selectedcatalog = value;         this.notifyofpropertychange(() => this.selectedcatalogname);     } } // ----------------------------------------------------------------- // --> can or equivalent? // ----------------------------------------------------------------- public bool canselectcatalogname() {     return !string.isnullorwhitespace(this.selectedcatalogname); } 

note: question in comments above.

there no inbuilt convention support can simple binding:

<combobox x:name="selectedcatalog" isenabled="{binding canselectcatalogname}" /> 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -