wpf - Login view - Login button is not disabled initially based on CanLogin value, untill we click it for the first time. -
i started looking caliburn micro 2.0.0 , started simple login page implementation. page xaml looks this
<stackpanel grid.column="1" grid.row="1"> <stackpanel orientation="horizontal" margin="2"> <textblock text="login name" width="100"/> <textbox x:name="loginname" width="200" /> </stackpanel> <stackpanel orientation="horizontal" margin="2"> <textblock text="password" width="100"/> <textbox x:name="password" width="200" /> </stackpanel> <button x:name="login" content="submit" width="100" margin="2"/> </stackpanel>
and view model class looks this
public class loginviewmodel : propertychangedbase { private string loginname; public string loginname { { return loginname; } set { loginname = value; notifyofpropertychange(() => loginname); notifyofpropertychange(() => canlogin); } } private string password; public string password { { return password; } set { password = value; notifyofpropertychange(() => password); notifyofpropertychange(() => canlogin); } } public bool canlogin { { return !string.isnullorwhitespace(loginname) && !string.isnullorwhitespace(password); } } public void login() { } }
i not sure if there mistakes in this. until click login first time, login button enabled.
and interestingly when work calibur 1.5 works perfectly....
please me fix this.
Comments
Post a Comment