Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am just about to embark on a learning path in WPF. I want to make sure I'm starting as I mean to go on, by learning the correct skills first.
I have found references to WPF being used with both C# and XAML. I was wondering, in a work-environment, which do you use to develop WPF applications?
XAML is a markup language. When you write XAML for a C# application, it is simply instantiating C# objects. So, you are really writing C# either way.
XAML is essentially a declarative way to write code. It is extremely common for the User Interface (often called the View) of an application.
In my opinion, a WPF application's View should almost always be in XAML. And anything that is not UI (e.g. the business logic, or the Model), should not be written in XAML. This is standard for the MVVM Pattern, which is extremely popular for WPF development.
The short answer is that you need both XAML and C# of another programming language like VB.NET to create a WPF application.
At the very beginning of your learning process you can get away with only learning XAML. Which is actually a good idea anyway. Learn about using dependency properties, attached properties, layouting without writing a single line of code at first.
Next you can write some event handlers, but I wouldn't spent too much time on write too complex code attached directly to the XAML windows as the MVVM makes your life a lot easier.
For MVVM I recommend using a framework, for instance MVVM light from Laurent Bugnon, he also wrote some excellent books, silverlight though, which describe MVVM.
https://mvvmlight.codeplex.com/
As I side note I should add that it is possible to create your GUI completely using code and without XAML. But I would argue that this is an exceptional case. The idea of WPF is really to seperate the GUI, using the declaritive XAML, from the rest of the application that is coded. As a beginner I wouldn't embark on the path of coding your GUI without XAML.
Another side note is that XAML is also used to declaratively create workflows using WF. So XAML is not used for GUI's alone.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
In Xamarin.Forms there's 2 ways to build an app's layout: in C#, or using a mix of XAML and C#. Is there any definite benefit of one over the other?
Xamarin should compile either into the respective platform apps (for droid, iOS, usw) the same, so the only differences I can see are that XAML splits the design and the code into separate files (.xaml and .xaml.cs), while the C#-only way avoids visual studio code complaining about the compiletime-generated functions in the .xaml.cs files. Is there anything I missed? A good reason to become fluent in reading the XAML markup when the C#-code is already intuitive for me?
XAML provides a more succinct and elegant definition of the user
interface, and has a visual structure that better mimics the tree
organisation of the visual elements on the page. XAML is also
generally easier to maintain and modify than equivalent code.
A declarative UI(XAML) is a better approach than doing the UI by code,
for the following reasons:
it's coincise, it's impersonal
except few things, XAML looks the same for everyone. you can't say the same thing about code-behind C# coding
it's more maintainable
much more easier to read and modify than code
it helps with a clear separation of concerns, between the UI and logic
tooling friendly; unfortunately Xamarin Forms today still doesn't have a designer, but this is supposed to change
I am NOT saying XAML is perfect. C# code is also good.
Read some similar discussions :
https://adventuresinxamarinforms.com/2015/03/17/xaml-v-code/
https://forums.xamarin.com/discussion/44117/xaml-vs-programmatically
https://forums.xamarin.com/discussion/58831/building-interfaces-xaml-vs-c-code
https://forums.xamarin.com/discussion/24682/ui-written-by-xaml-or-pure-code
Xamarin UI: Programmatically VS XAML
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I am short on time,and I need to develop a desktop app that will be used in a firm.
I dont have time to learn mvvm or any other design pattern.
Can I develop an app without it?
I did some basic sql crud with a table and it works fine,but I wanted to ask you if I can develop a whole app without some of this design patterns.
EDIT: You can do it,but you have to be carefull,also there will be more effort included if you want to edit some things down the line.
You don't need to rely on MVVM when using wpf. Really the keys to
using wpf properly are:
-Use commands instead of events (you might do this without realizing
it, but check to make sure)
-Use data binding instead of getting values
off of controls directly
-Set the data context and bind to that instead
of binding to the code behind
MVVM works really well for these two
things but is not required. Specifically, MVVM requires a 3-tier
strict separation of concerns that can just as easily be done with
MVP.
Source :
Developing WPF software without MVVM
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I was working with Windows Forms for a while now, and due to certain limitations on Forms, I want to work my way up to a better way of making GUIs. I found WPF, which looks pretty promising, but I'm asking you guys, if there are any better ways for doing nice GUIs for Windows with C#?
Thanks in advance!
I would look for MS roadmaps and instructions where they plan to drive the platform. For example:
.NET Technology Guide for Business Applications
This is since nov 2013 but still valid to a large degree. Among other things it states that (emphasis mine):
.NET Windows Presentation Foundation
This is the preferred technology for Windows-based desktop applications that require UI complexity, styles
customization, and graphics-intensive scenarios for the desktop. WPF also takes advantage of XAML views.
And WPF development skills are similar to Windows Store development skills, so migration from WPF to
Windows Store apps is easier than migration from Windows Forms.
HTML5&JS-based apps is an alternate route but I consider it inferior for development efficiency and maintainability reasons. If you are a scripting fella, then it's worth a look.
By my experience WPF is definitely the way to go for desktop development.
There is definitely a learning curve migrating from Forms development to WPF, but in my opinion the effort is well worth it, and not simply because WPF is aesthetically different to Windows Forms.
WPF encourages you along the MVVM ("Model-View-View model") path and a separation of concerns between UI, logic and data elements. As an aside, MVVM is one of a number of MV* architectural patterns - there's some debate about what constitutes the difference between the different patterns, but consensus that separation of concerns is absolutely a good thing. For example:
http://www.infoworld.com/article/2926003/microsoft-net/exploring-the-mvc-mvp-and-mvvm-design-patterns.html
https://nirajrules.wordpress.com/2009/07/18/mvc-vs-mvp-vs-mvvm/
What is difference between MVC, MVP & MVVM design pattern in terms of coding c#
In terms of specific advantages over Forms, there's a lot of stuff you get out-of-the-box with WPF, like two-way data-binding and UI threading for instance. But I found that the change in thinking about problems is equally valuable; when I started thinking in MVVM, things like asynchronous programming (e.g. calling web services from windows-based client applications) just became much easier to conceptualise and reason about.
MV* is all the rage in web development, too, so the skills (and, in an ideal world, some of the code) are transferable to the web.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
What choice is the best one, coding or drop and click to generate xaml code?
If you are gonna work with visualization before doing coding or maybe doing both, should the process be taken in VS 2010 or Blend?
Is there any similiar code of WPF's C# WPF in other context for instance in Biztalk, sharepoint (except Winform) etc?
I heard that Microsoft Blend should be used for creating prototype only, is that true? Is Blend strong enough to work with user interface?
WPF makes it simple to separate the look&feel of the application and the logic behind.
Blend is used to create styles, and may be used to create GUI prototypes. All this work however can be done in VS too. It's only a matter of convenience.
If you're using Visual Studio you can install Xaml power toys add-in which is able to do many different things for you (eg. generating DataGrid columns of a business form for an entity class)
I heard that Microsoft Blend should be used for creating prototype only, is that true?
Blend is all about what you see. Vs is about the code.
If you are gonna work with visualization before doing coding or maybe doing both, should the process be taken in VS 2010 or Blend?
Definitely blend.
What choice is the best one, coding or drop and click to generate xaml code?
Doesn't matter. You do what's faster for you. I prefer typing, but someone else might prefer clicking.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am starting to learn c# and wanted to create an actual app which one of the two would you start with?
Personally, I would learn WPF. We use a lot of Winforms, but we're in the process of migrating to WPF. I think that's a more future proof set of skills. WPF Virtual Labs are a good place to start.
My rule of thumb is to choose the most recent technology that doesn't require your users to go through extra effort. If you have to support Windows XP, then WinForms is the way to go as it doesn't require XP users to install .NET updates. If you don't have to worry about XP, then WPF is probably the ready to go.
I recommend WPF - it is now very mature and well supported. Of course, winforms is still supported and some new development is being done for it. However, WPF is significantly more sophisticated and powerful. Almost as importantly, the tool support for it is MUCH better than for WPF.
Here are some links for you.
A Guided Tour of Windows Presentation Foundation
Windows Client .NET
WPF vs Windows Forms
I would say learn both to have a stronger foundation of knowledge and be able to work with legacy code, but put more effort into WPF because it will eventually replace WinForms.
The basics of either are much the same -- WPF offers a lot more features by way of declarative UI definition and skinning/theming, and a slightly different set of layout techniques. While you're at the "Hello world!" stages, it makes little difference -- certainly less than using either GTK# or the Swing implementation in VJSSupUILib would.