iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hi Guys,
How do we implement binding between a platform-specific library without breaking the rules of the MVVM pattern using the Crosslight framework? First off, we could design an interface that will be implemented using an IService, which can be used by the viewmodel. But that's how we ended up so far. As a note, the reason why we need an interface is because the app will be using different mobile printers from different manufacturers (e.g. Bixolon, Zebra, etc.). There are events or listeners from each binding library SDK that need to be implented in a view (e.g. viewcontroller, activity, page, etc.). So, the question is how do we implement such scenarios with the help of the Crosslight framework? How can we implement these events or listeners wherein we can bind each to a viewmodel like a CommandProperty does?
Hi Jimmy,
From your descriptions, I will assumpt that you have knowledge about how to implement custom services in crosslight. In case that you have not, you could refer to Extending Crosslight Tutorial.
And assuming that you have able to bind those events from library SDK to your view (viewcontroller/activity), you could invoke viewModel method from the event handler (ex: this.ViewModel.OnPrintDone()) on your view (viewcontroller/activity). To make your code look more organized, you could create an Interface, ex: IImplementPrintServices, that will describe all method should be implemented by ViewModel that used that custom service.
How can we implement these events or listeners wherein we can bind each to a viewmodel like a CommandProperty does?
For your information, binding like that only work for binding from viewmodel to view item, so it will not work with service. In case you interested in creating a custom binding adapter, you could refer to Create Custom Bindable Properties and Binding Adapter. Hope this will help you.
Best Regards,Leo
For your information, Custom Bindable Properties and Binding Adapters only work for binding from ViewModel to view item (ex: TextView), not for binding to view context (ex: Activity). Usually, Bindable Properties and Binding Adapters was used to create a binding for custom view or extending existing binding adapter of a view item (ex: TextView) to add a new property binding, like the one described in Create Custom Bindable Properties and Binding Adapter. Hope this will help you.
Yes, I believe the second paragraph makes sense... and that is how it is currenlty implemented. However, the custom bindable properties and binding adapters are not.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname