As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I've to create a small windows application(no silverlight, no windows phone, no windows 8 app, ...), and since I've some extra for this application, I decided to take the time to learn the MVVM pattern.
I read about it and I understood the principal part.
I found the MVVM Light Toolkit, but I find hard to start with. Except this page where I find the class names, I can't find any documentation about this, some kind of "getting started" section.
I tried to start with that, but I can't find:
What is the ViewModelLocator, and how should I use it
A simple example of a ViewModel, extending the ViewModelBase (for example, I don't know if I should call RaisePropertyChanging, RaisePropertyChanged, both, if I should put just the property name, ...
Some example about how to use the Messenger (in which part of the code I should register, examples of conditions)
After some search on the net, either I find informations for windows phone(with Page, ...), either it's years old topic.
So do you know where I can find this kind of information?
Thank you!
To answer your questions:
The ViewModelLocator is a class that allows you to expose your various models via properties, and do whatever initialization is required. You can then bind the DataContext of a page or control conveniently to a ViewModel.
DataContext="{Binding Main, Source={StaticResource Locator}}"
Here is a similar question
Call RaisePropertyChanged([name-of-property-here]) to update your bindings.
Use the Messenger as a way to easily notify your page when the state of the application has changed, to display an error message when an error has occurred is a good example. To use Messenger, you can register in OnNavigatedTo
Messenger.Default.Register<YourCustomMessage>(this, OnYourCustomMessage);
and don't forget to unregister in OnNavigatedFrom
Messenger.Default.Unregister<YourCustomMessage>(this, OnYourCustomMessage);
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I have an application written in C#, using .Net 4.0 framework. As the application is kind of an old application, so its using window forms. The application is very simple for now, it doesn't have high graphical interface like using WPF and Silverlight. I have now decided to move the application to the next level, the latest, one using current trends and great user interface. What are my options of improving this application design wise, performance wise and looks wise? Like using WPF, MS Silverlight or any other cool technology out there?
I kinda more need ideas what can I do to get to high tech application? Some examples of some cool applications would be also appreciated.
A little about the application:
Its a windows desktop application, using Access as a database used for some finance analysis.
If more information needed? Please let me know.
In short: Id say WPF is all you need technology-wise. Its really neat, i love the looks of it and its quite easy to use (especially with Expression Blend!)
On a side note:
The big issue here will be designing a good interface, not using "shinier" buttons. Currently, the UI design is getting more and more elements to it, changing to UX design. You can read about it if you google, a few links to start with:
http://msdn.microsoft.com/en-us/library/aa511258.aspx
http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/industryinsights/solutions/pdfs/Forrester_Best_Prac_In_User_Exp.pdf
http://developer.android.com/design/get-started/creative-vision.html - this is about Android, but it can and should be transferred to a desktop environment
Ill use a little metaphore: Youre asking us "what kind of paint should I use for my masterpiece painting that will put Leonardo Da Vinci to shame?". Are you sure you already know what and how to do with that paint? Some artists drew masterpieces using only a single pencil, others couldnt do anything of value despite using the best tools available.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Is there any way i can change my existing winform app to WPF,i had used c#.net and SQL Server 2005, I am a first timer in WPF, please consider before answering.
thanks
No - there is no "automatic" way to switch - nor would you want to do so.
While it's possible to write WPF in a manner very similar to Windows Forms, you typically do not want to do so. It really defeats the purpose of changing. The advantages of WPF really come into play when you take advantage of Xaml and data binding to their fullest extent, which wouldn't happen with an automatic conversion.
That being said, it's always possible to start writing some of your new user interfaces in WPF, and still use them within the existing Windows Forms project (via ElementHost). This allows a transition to WPF, without having to "convert" at once.
Any application logic which is properly decoupled can be used from both Windows Forms and WPF, as is - so the only thing that has to change is the portion of your application tied to the user interface.
It depends on your project structure, WPF is all about UI. If you've a layered solution you can simply change its UI from WinForm to WPF, but There is no automatically way to do that, You have to rewrite your UI.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I wanted to try to bring forward some old snippets
I had forgotten, to change the default behaviour of VS2010 when creating code behind
c# for each event I defined either
From XML, or
From the control properties panel, or
From assigning and defining an event handler loading (overloading?) (control.event.handler += event handler;) entering the event handler without the handler defined would give you a stub subroutine at the end of the file.
All three coding actions can occur in three different setting but should create the same code behind.
Now I want to put my bells and whistles and stamp my actions with a debug, ifdefs, and
have the code explain to me in a diagnostics output what it is doing, which is generally different from what I want it to do. It can turn into a lot of typing. Snippets are way cool. And are highly personal. I'm certain as I get more experienced I will shed my training wheels. But I remember having done this in vs2010 by hacking underneath VS in its internal snippets or xml settings. It is not a regular snippet; or is it ?
There is also a way to save this in a local directory so as to override the default code behind generation/snippet. I can't seem to find this again. What is a workflow and is that
what I'm looking for ? I'm installing VS2010 express and pro and testing/porting code.
I would love to get action back. Where is it in VS2012 ?
Off of the main menu Tools->Code Snippet Manager or via the Quick Launch type "snippet". Also you may want to add the "Snippet Designer" add in via the Tools->Extension and updates.
In 2012 if you ever forget where a command is, use the Quick Launch to help one find it.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Update: Thanks for closing my question because it might solicit opinions or discussion. That was the point as spelled out by the disclaimer below. Will someone please reopen this?
Disclaimer:
For starters, I realize how this question and possible answer isn't very black and white, but I am at an impasse and I need some different points of view.
Question:
When I am working in WPF, I often use the MVVM pattern to make things happen. In any given program I will have a bunch of View Model classes that all derive from a class called 'ViewModelBase' and it has been my habit to suffix the class names with 'ViewModel' However I am finding that I wind up with a lot of classes that have very long names such as...
InputDataViewModel
CalculationsViewModel
and so on. I like that they have some context in their name, but they can be a bit cumbersome when it comes to generic programming, etc. I am beginning to come to the opinion that the fact that they all derive from 'ViewModelBase' is enough information to identify them as view models and so the suffix on the names is becoming more trouble than it's worth.
Does anyone else have a similar experience or insight to offer on this issue? Pros, cons, etc?
Also:
No, I am not using an MVVM framework like caliburn, MVVMLight or anything like that.
Assuming that you are using a good IDE, like Visual Studio, you really don't need to add ViewModel. This is because Visual Studio's intellisense makes it easy to see what a class derives from, the methods it supports, etc. The benefit of adding the suffix is that people who don't use a fancy IDE will still be able to work with your code.
Also, you might have other classes that involve Calculations. Adding a unique suffix to each class name makes it easier when you or another developer is quickly scanning over your code. Without the suffix, it may require a further lookup in another file to determine what a class does.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Does anyone know opensource WPF applications created using MVVM Light Toolkit? Or any samples?
Well I wrote a note taking app using mvvm light, if you wanna check the code:
ApuntaNotas
It's true that MVVM Light is lacking of big examples... We need to create that examples :)
There are not many public applications using the MVVM Light Toolkit. I know a few applications that use it, but I cannot always talk about it unfortunately. Probably it is just too new.
I am currently very busy writing a Silverlight book, but my plan is, as soon as I will be done writing, to create a reference application on Codeplex and to implement it in WPF and in Silverlight. In the mean time, if anyone else wants to create samples, let me know :)
Laurent
http://www.codeproject.com/KB/silverlight/IssueVisionForSilverlight.aspx
I have T4 code templates that generate your view/viewmodel for mvvm light and also other tricks. Download here
Also see this example using MVVM Light and MEF
Laurent, MVVM Light's author wrote an article in the latest MSDN Magazine: Using the MVVM Pattern in Windows 8
Hmm, I don't have any code myself but have a look at Shawn Wildermuth's blog, he has done an example app http://wildermuth.com/
It's Silverlight and also uses RIA services, but hte basics should be on target.
John Papa occassional has sone stuff up as well http://johnpapa.net.
I have written a Coding Dojo for Silverlight - Blend and MVVMLight.
http://www.alphablog.org/2011/08/07/coding-dojo-silverlight/
Take a look and see if it fits to your needs.