Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LoginButton should support data binding / MVVM architecture #33

Open
BobDickinson opened this issue Sep 4, 2013 · 1 comment
Open

Comments

@BobDickinson
Copy link

The general assumption here is that Win8 controls that consume or produce data should support data binding, and in the case of the LoginButton, which does both, it should support "TwoWay" data binding (for at least CurrentSession, and ideally CurrentUser as well).

See this "question" on StackOverflow: http://stackoverflow.com/questions/18269169/facebook-c-sharp-sdk-loginbutton-state-management

The LoginButton intentionally obscures/protects the CurrentSession and CurrentUser, making it very hard to integrate a LoginButton into an app of any complexity or sophistication (a "real" app) without some non-trivial code-behind. Ideally, these values should be exposed so they can be bound to a ViewModel (or equivalent) using TwoWay binding, allowing them to be initialized from app state (ViewModel) when a page is loaded, and allowing the ViewModel (or equivalent) to be automatically notified when they change (based on user interaction with the control).

The only way to do this right now, as far as I can tell, is to have a bunch of code-behind that initializes the values using SetValue on the button, and that responds to the session state changed and user changed events in the view, which is fairly creepy and certainly not in keeping with separation of concerns (MVVM, etc).

In a real world app where you are separating the view from the rest of the app logic (so, for example, your designers can work on the UX in Blend), you don't want any code that you don't absolutely need in the view code-behind, and you wouldn't need any of that if the LoginButton supported TwoWay data binding for these values.

@sanjeevdwivedi
Copy link
Contributor

@BobDickinson Can you please provide a pull request for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants