Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using non-standard UI's with mvvmcross? (databindings for things like gtksharp)

I'm looking into getting started with C# app development. I have experience in web-based technologies but am just starting up with desktop/MVVM.

I've been watching and reading up on various mvvmcross tutorials, and I'm really looking forward to working on an application using the framework, but I just have a quick question which might have more to do with databindings than mvvmcross itself:

If I build my application.core through the mvvmcross library, would it be relatively easy to reuse that core library to develop UI's for non-mvvmcross targets?

I understand that mvvmcross simplifies a LOT of the display logic, so by doing this I would have to write up code to connect with other guis using their methods, but I'm wondering if anybody can comment on

a) Whether it would be possible

and

b) If it would be possible without a lot of workarounds/hacking around my mvvmcross core implementation.

My use-case is that I plan on using mvvmcross to develop for either WPF or WinStore first, then, if there is demand, add a Mac UI. But eventually, if the demand is there, I want to be able to also port my application to Linux (probably through gtksharp,because it sounds like that's furthest ahead in development right now). Would my application.gtk project be able to easily call/work with the classes, methods, and functions that are defined in the mvvmcross core application, or would that logic have to be re-written to handle data in a way that's more suitable to gtksharp?

Thanks.

like image 888
dkisselev Avatar asked Nov 27 '13 06:11

dkisselev


People also ask

What is mvvmcross data binding?

Within MvvmCross, data binding was initially built to mirror the structure provided by Microsoft in their XAML based frameworks, but in more recent developments MvvmCross has extended data binding in new directions. This article focuses first on the core ‘Windows’ data binding approach, but then later extends to some of the newer ideas.

What is the use of MVVM pattern?

Thank you. Model-View-ViewModel (MVVM) is a UI architectural design pattern for decoupling UI and non-UI code. With MVVM, you define your UI declaratively in XAML and use data binding markup to link it to other layers containing data and commands.

What is the difference between ViewModel and DataContext in mvvmcross?

DataContext is simply the C# name for the property on a View to which the ViewModel is assigned. ViewModel and DataContext can be considered as the same thing. Data binding has always been at the heart of MvvmCross, and the functionality has grown over the different versions of MvvmCross.

What is the difference between mvvmcross and Tibet binding?

When looking for a name, MvvmCross first looks for a matching ValueCombiner, and then second for a matching ValueConverter. In addition to supporting multiple bound source values, Tibet binding further introduces nested evaluation of value converters and combiners.


Video Answer


1 Answers

Sorry for the super-late reply, but I don't really think this is too feasible, at least as stated. The main problem, as I see it, is that MvvmCross would still likely have to be a dependency for most of your core library(ies). You could certainly have a core library with that as a dependency and just not really use it, but that seems like a waste and kind of goes against the question as asked.

Without it as a dependency, you lose quite a lot of stuff, really all the stuff that makes it such a nice framework. What you'd really want to do is just implement INotifyPropertyChanged and work off of that. Some other, simpler libraries you might be able to use include the Bind library from Praeclarum (https://github.com/praeclarum/Bind), Fody.PropertyChanged (https://github.com/Fody/PropertyChanged), Json.NET, and SqLite.NET to achieve a basic but powerful core library that can then be added to with an MvvmCross-based library, but I don't know if there'd even be any reason to do that. Another helpful link would be: http://arteksoftware.com/end-to-end-mvvm-with-xamarin/.

like image 126
WolfgangSenff Avatar answered Oct 01 '22 01:10

WolfgangSenff