binding button to IsAuthenticatedbinding button to IsAuthenticated
Old forum URL: forums.lhotka.net/forums/t/1035.aspx
dean posted on Saturday, August 26, 2006
So I was trying to bind a button's enabled property to the businessidentity.IsAuthenticated property. And I could do so but changes to the IsAuthenticated property are not changing the enabled status of the button.
So I thought it's because Identity inherits from readonlybase and there is no propertychanged event being fired. So I changed Identity to inherit from businessbase instead of readonlybase. Then in b
usinessprincipa in login/logout I have it raise the new identities PropertyChanged event. But this doesn't do it either.
I have tried both update modes for the bindings and bindingsource.resetbindings. No luck. If I rebind the button that does change the value but of course pretty much defeats the purpose behind databinding.
Anyone have any thoughts?
Thanks,
Dean
dean replied on Saturday, August 26, 2006
Ok - figured out one way to do this.
I think the problem with binding directly to the identity is that it is replaced during the login/logout procedures. So the binding is no longer valid.
Rather than change the businessIdentity to a businessbase obj I have a login class that is business base. This has an IsAuthenticated property so I bind to it. All my login/logout calls go to this class so I can raise a propertyHasChanged("IsAuthenticated") when the principal changes and this object is not replaced during the login/logout operation. This seems to work.
I have some button panels that give access to my program. This way I can disable/enable them depending on whether a user is logged in or not.
Dean
Copyright (c) Marimer LLC