How to start using MVVM in Metro Applications? - c#

I was watching that there's applications using this pattern. For example, Bewise.Cookbook is implementing MVVM framework from Galasoft.
I want studying some labs in Windows 8, but I have my doubts about using this pattern in Metro Applications.
Someone knows a good site where teach you using Win8 with MVVM?

MVVM has nothing particular in Windows 8. If you don't find any tutorials about using MVVM with Windows 8, try searching for tutorials about MVVM with Silverlight.
You can also check this:
An Address Book Application Made in MVVM For Metro Style App in Windows 8 (Part 1)
An Address Book Application Made in MVVM For Metro Style App in Windows 8 (Part 2)

I recommend StyleMVVM. It's an MVVM framework designed from the ground up for the Metro platform. It includes its own attribute based IoC, implementations for ICommand and attached command behaviors, as well as services for Tiles, Badges, Toasts and Settings Pane (charm flyout). It also supports all three languages (C#, C++/CX and HTML/JS).
To make things easy to get started there are a number of C# & C++/CX templates as well as a nice example weather app.

Look at the MVVM for Windows 8 library. It is very simple. You can add its NuGet package to your project. It also has an on-line project template for visual studio. So it is very easy to start. And it is library but not a framework, so you can use only features you like.

Related

Common controls for UWP and WPF

Is it possible to create common controls that can be used for both UWP and WPF applications?
Tried digging over the .NET and found out that code can be shared across them using .NET Standard but what about XAML controls/UI ?
You can't directly use WPF controls in UWP apps, as there are many features of WPF XAML which are not yet available in UWP. So direct forward compatibility is not available here. Evenso, upgrading existing WPF controls to UWP should not be too hard, usually all it takes is to rewrite some parts of XAML but the actual business logic behind them can be ported 1:1, as most is covered by .NET Standard.
However, at Build 2018 Microsoft announced UWP XAML Islands functionality, that will allow developers to upgrade the UI of WPF apps to modern UWP design, including Fluent Design System features. In the near future you will be able to do this with all UWP controls (including custom), once the APIs are ready, but currently you can at least use the modern UWP WebView control in WPF, which is part of the Windows Community Toolkit.

Using WPF .NET APIs in a Windows 8.1 Universal application

As I am really really new to Universal Apps and I am coming from previous experience with WPF and Silverlight I was wondering if there is an approach I could use to take advantage of the .NET 4.5 APIs in an project created as Universal App. I know this might be a stupid question but as the idea of Universal Apps is to be "universal" it bright this thought to my head "Could I create a 'class library' for WPF and use it in an Universal App".
I have been researching this on the web but with no success so decided to test my luck here. Also if anyone could point me to some good resources in getting started with Universal app (for WPF/Silverlight .NET developers) it would be awesome.
You should be using Portable Class Libraries. It will give you the option to select which platforms to target. Keep in mind that the API surface available to Universal Apps are somewhat of a subset of the API surface available to WPF. This is somewhat analogous to how Silverlight was a subset of WPF in the beginning and then branched out somewhat over later versions.

Building apps for windows tablet.

I am new to wpf. Hence, kindly co-operate with my questions.
I want to build an app that runs on windows tablets. This is not to windows store app, rather, I will be developing this app for some company to visualize the data they have. And they will use this app on tablets or other touch enabled devices.
Background:
App will have some graphs and other visualizing diagrams. And WPF MVVM pattern will be used to develop the app.
My question:
My current system is:
System: HP elite book revolve 810 g2 tablet
.NET Framework: 4.0
Visual studio 2012
Can I develop a tablet app with the above specification?
where can i find coding documents on coding for touch devices in WPF mvvm pattern?
How can I use graph or any other visualization method in wpf. I mean, do I have any library that provides API's for different graphs?
Please help me in answering above.
Thank you
This questions will lead to long answers.. I´ll try to make it short!
The elite book revolve has an I5 and Windows 8 / 8.1. You should not have problems developing Widnows apps with that.
Visual Studio 2012 is fine as well, you might want to download the windows phone toolkit (if you want multiplatform apps).
You will need to use framwork 4.5 to develop Windows 8.1 RT apps though - and this is what you want to do if you want multi device apps. If not then it`s just normal Windows applications that can olny be runn on Windows devices (not Windows phone, or RT tablets)
It seems you are a starter in developing Touch apps.
2.1 Honestly you should consider buying a book before developing. The "Windows 8.1 Apps with XAML and C# Unleashed" one is really good
one - you can even read a good share of the first chapter with example code (see links below)!
2.2 I added a few links to ressources that could help you. Consider looking at MVVM, WPF and Touch coding independently. There are tons of tutorials available!
2.3. Doing touch support is pretty straightforward, it`s just another event handler (touchdown instead of mouseleftbutton down) so all you need is to know how to best handle events in MVVM (link attached below). Another thing is gesture support (see link)
Here is the standard library of xaml controls.. pretty basic but you can do a lot with them: https://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh465351.aspx
if you need better /more graphical controls you might consider using Developer Express or similar APIs
heres a list of the graphic tools they provide. Pretty neat: https://www.devexpress.com/products/net/controls/winrt/
Theres also a WinRT XAML Toolkit available: https://winrtxamltoolkit.codeplex.com/ (Tutorial and Graph Preview see below)
Additional Links:
Windows 8.1 Apps with XAML and C# Unleashed (example with code):
http://ptgmedia.pearsoncmg.com/images/9780672337086/samplepages/0672337088.pdf
MVVM General developing: https://joshsmithonwpf.wordpress.com/a-guided-tour-of-wpf/
MVVM in Windows 8: https://msdn.microsoft.com/en-us/magazine/jj651572.aspx?utm_source=rss&utm_medium=rss&utm_campaign=mvvm-using-the-mvvm-pattern-in-windows-8
WinRT XAML Toolkit Tutorial (Windows Store example):
http://eren.ws/2013/10/15/using-graphs-and-charts-in-windows-store-apps-boredom-challenge-day-11/
Best way of event Handling in MVVM (needed for Touch event handling):
What's the best way to pass event to ViewModel?

Using MVVM Light and Okra Framework Together

I am new to Win 8 Development (Just started planning an app) and know people using MVVM light for Windows Phone.
My Oneline Surfing for Development Framework I selected 2 Frameworks:
MVVM Light for Win 8
Okra Framework for Win RT
And after reading the blogs I am pretty confused on what to use.
What are the advantages these will provide over one another and also .. Can I use Both of them in a single project (I Prefer MEF way of using Containers but like the VS Templates of MVVM lights)
Any Help in this direction would be helpful....
After using both frameworks... I share here my experience....
If I want simple DI, MVVM Light is the way to go....
But I always like MEF and hence I used OKRA F/W.
Also the are lot of useful classes for the different features of Win 8 Apps (Navigation, Settings pane) etc....
And yes it's easy to use as tutorial are always available... and the author response were prompt...

Deploying Prism app as both WPF and Silverlight

Is it possible to develop a Prism 4 app and then use it both as a WPF app and a Silverlight app?
If not what is involved in converting it from WPF to silverlight?
Yes it's one of prism goals. Take a look at article 'Building WPF and Silverlight Applications with a Single Code Base Using Prism'

Categories