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
Post a Comment