|
The results available with WPF can be great.
The way to achieve those results is a pain in the backside.
When someone develops a GUI tool to effectively edit XAML it will be a vast improvement.
Personally I don't think that is now ever going to happen and Xaml will eventually die.
MVVM # - I did it My Way
___________________________________________
Man, you're a god. - walterhevedeich 26/05/2011
.\\axxx
(That's an 'M')
|
|
|
|
|
Agreed - the ridiculous verbosity of XAML makes if very unwieldy.
|
|
|
|
|
What are you missing in the XAML editor? I prefer to write XAML instead of using the designer and I think it is faster than doing the same with WinForms in the WinForms designer.
I can't see the "ridiculous verbosity of XAML". You write the properties which you would set in the property window for WinForms.
If you have a look at the generated WinForms code, that is ridiculous verbosity.
|
|
|
|
|
Obviously writing Xaml is faster than writing Winforms purely in code - but thee designer for Winforms works and works reasonably well.
The designer for Xaml is slow, buggy, crashes frequently, caches some stuff that require a restart of VS to fix, doesn't handle some things at all - so you need to resort to editing Xaml.
Now for a simple form with a few controls, that's all good. For a complex control with many many panels, grids, lists etc. changing the layout is a nightmare - just negotiating the Xaml can be a nightmare because VS2010 takes so damn long to parse the Xaml (even when not displaying the view) that one loses the will to live waiting for it!
Christian Wulff wrote: ridiculous verbosity of XAML
It wasn't me that said it - but I can see what people mean. it is verbose.
Sure you only set the same properties you would by using the forms designer and setting properties - but again the designer lets you down by making it necessary to hand-write much of it rather than using a good tool to save you mucking up the level of curly braces etc.
Christian Wulff wrote: If you have a look at the generated WinForms code, that is ridiculous verbosity.
Absolutely. But, then, you don't need to because the designer works.
MVVM # - I did it My Way
___________________________________________
Man, you're a god. - walterhevedeich 26/05/2011
.\\axxx
(That's an 'M')
|
|
|
|
|
_Maxxx_ wrote: For a complex control with many many panels, grids, lists etc. changing the layout is a nightmare - just negotiating the Xaml can be a nightmare because VS2010 takes so damn long to parse the Xaml (even when not displaying the view) that one loses the will to live waiting for it!
My experience is that with MVVM, I don't have one complex control with many many panels, grids etc. because these are divided into some sub-controls.
I choose to edit the XAML directly because for me it is easier that way and not because the designer is buggy. Same like I write HTML instead of using an HTML editor.
But most of my WPF experience comes from VS 2012 and VS 2013, which are much faster and more responsive than VS 2010.
I didn't want to start a religious war, just sharing my opinion that once I learned MVVM, I prefer WPF and XAML to WinForms and think it is easier
Especially because I don't write much code-behind and don't need to subscribe to many control Events.
|
|
|
|
|
Started reading this reply and I was thinking it sounds like this guy is still using 2010 or older. The new versions on studio have gotten much better at rendering xaml in the designer without crashing hanging etc.
Between WinRT/Silverlight/WPF I rarely use or look at the designer, other than maybe once I am done to check my work. The designer generates horrible xaml anyway.
|
|
|
|
|
Die and give way to what?
|
|
|
|
|
I'm not sure what you mean with bringing CSS horrors to application development?
I love xaml / C# combo.
It's indeed a steap learning curve though. Once you understand the magic, I feel like it's super easy (and fast) to get stuff going on screen. MVVM is a must, though.
|
|
|
|
|
I have been working with WPF for something like 7 years, and I still go through times when I wonder if it is insane, or insanely beautiful.
I usually conclude that it is a bit of both.
Often it takes a lot of work and verbosity and debugging to hook something up in XAML and have clean separation when it could be done with a bit of C#, but doing things declaratively is a bit of a game. It can be fun to learn, but sometimes it just isn't worth it to achieve the separation between code and layout. It is an addictive game, though, that pulls you in deeper and deeper.
At some point along the way it clicked, and I started breathing Styles, triggers, attached properties, DataTemplates, ControlTemplates, Bindings, RelativeSources, CollectionViewSources, StaticResources, DynamicResources, TemplateBindings, BooleanToVisibilityConverters, custom IValueConverters, DoubleAnimations, LinearGradientBrushes, Grid.ColumnDefitions, TransformGroups, AffectsRender, Storyboards, oh my!
"I don't often" enjoy writing XML, but when I do, it's XAML. I never used Blend, doing most by hand in Visual Studio, with its Intellisense that reads your mind, letting you avoid writing the bulk of the actual XAML. (I'm stuck with VS 2012 when editing XAML, since for some reason 2013's XAML editor crashes on my stuff by running out of virtual memory and I'm not alone.)
For newbies, I definitely recommend learning via the top MVVM frameworks and/or books, and keeping references like http://wpftutorial.net/[^] handy, as WPF has a uniquely obtuse learning curve. I like to learn things by getting my hands dirty and diving in, but for this, take the time to learn some of the theory from someone who knows how to present the concepts in an easy to manage order.
Also when you delve into bindings and collections, check out Bea Stollnitz's blog[^]http://www.zagstudio.com/blog[^]. She is some kind of superhuman that invented and can explain the bindings.
Also, browse WPF articles here on codeproject, so you can see all the cool things that can be done. When WPF is my favorite thing, CodeProject becomes my favorite site. (And if I get stuck, stackoverflow is my go to.)
I also used to avoid creating dozens of lines of boilerplate crap to do something simple. WPF made me get over it, eventually. Whether it's a new style that seems like way too much text to set a property, or a custom IValueConverter class to do some trivial conversion, or some utility class that traverses the visual or logical tree, get over it. Embrace the verbosity. (And there are some cool free 3rd party expression libraries that ease the pain by letting you inject a bit of code into XAML to avoid converters.)
Get Dr WPF's Visual Studio snippets[^] for writing Dependency Properties. It is insane to have 30 lines of code to add a WPF property to a class no matter how you slice it, but you might as well at least not type it in each time.
...after all I have learned, I still feel I have a lot left to master. It makes me both scared and excited -- and not sure if I have Stockholm syndrome or not.
I think Microsoft has been good at creating brand new things that are brilliant, just not totally brilliantly. And not with polish and unlimited foresight (which is an order of magnitude harder.) I'm looking forward to the next WPF, if there is one, whatever it ends up being. Qt has QML which is JSON-styled, which I generally prefer to XAML/XML. HTML5+javascript+CSS+jquery is full of possibility and ubiquity, but it also seems to be a nightmare, in its stylistic feel, when coming from the nice world of strongly typed C# desktop apps.
If I had unlimited time, I would love to create or help with an open-source (MIT/BSD/MPL so it is embeddable) cross platform C# successor to WPF (that somehow also worked on the web, such as via Mono/Unity3D) with all of the great declarative, data binding, and composition features so we could all live in a GUI paradise.
|
|
|
|
|
It all sounds very clever, but is it any good? What are the advantages over 'the old ways'? Is it a bit like the myth of code reuse?
|
|
|
|
|
Great tips! Should be a Code Project article. Let me know when you post it. :
|
|
|
|
|
I am in no position to answer your question, but when WPF was new I looked into it. It looked great and for a time i got very excited about it, but I never had the time to study it and in the end I decided that it wouldn't let me do anything I wanted to do that I couldn't do already. I'm sure I am wrong, there must be advantages. As for 'impenetrability', well that doesn't surprise me. I always find MS logic somewhat odd, though there can be no doubt as to the usefulness of their products in some situations.
|
|
|
|
|
Technically assembler can do everything you need as well. Are you still using that?
The power of xaml and therefore wpf, is that it is implemented in an incredibly consistent and logical fashion. Meaning that you can often predict where to do or find things in the xaml code even if you don't know what it is yet. I primarily contrast that to html which is the ultimate design by committee end product.
There is a learning curve both for xaml and mvvm, but once over that curve you will be amazed at just how productive you can be.
|
|
|
|
|
I am still using assembly language as a matter of fact, though more for fun than for actual applications, though it can be useful. I'm sure that WPF offers rewards, but I have too much on my plate at the moment to take up WPF. It is not high on my list of priorities. Isn't that the problem? Too many technologies to choose from?
|
|
|
|
|
lol cool! I haven't used assembler since college days.
The analogy I was trying to draw was not that nobody uses assembler; rather that assembler can do everything, so why bother programming with anything else? Its the same logic you used to invalidate wpf.
(To your very valid concerns/points on time)
I guess when I am looking at a technology I prioritize gains in productivity and maintainability ahead of technical capabilities. I suppose largely because most platforms/techs these days have very similar technical capabilities... Think java/web/winform/wpf/Silverlight/winrt/etc. when you consider what is technically possible there is not *that* big a difference.
If time is that critical keep in mind you do not have to go all in right away. It is absolutely possible to ease into wpf using the same coding workflow you would do in winforms, (drag and drop designer, double click to add handlers, etc.). Its just that MVVM pays huge dividends via time saved during refactoring down the road, its makes it hard to roll a UI in xaml and not just go ahead with MVVM as well.
|
|
|
|
|
Well, I sat down and tried a WPF tutorial. All seemed very simple, very much like Winforms and I was beginning to become optimistic. However, when I run (debug) the application all I get is a black page, a crashed browser and no error message. For some reason I was not surprised as it brought back painful memories of problems I have had with other MS technologies.
|
|
|
|
|
I just started, too.
So far, the only thing I like about it is that I can have a rounded-corner chromeless window without using third-party code.
Whee.
|
|
|
|
|
Keep digging and you will find a lot more
|
|
|
|
|
My only gripe with WPF is XAML, as I dislike tag based languages (that includes XML and HTML).
|
|
|
|
|
I am always interested when people make the argument that learning something new will make you more productive, efficient, or valuable than using old technology without any qualification on the type of project being developed.
We have been developing a project in winform for seven years. We looked at doing the next version of the project in WPF and after months of development concluded that there would be a negative ROI based on the type of project we were developing.
Maybe XAML / WPF is valuable on some projects, but not ours! So quit making claims without qualifying the type of development.
I would really like to have discussions on what type of development projects WPF/XAML work BEST. And what changes could be made to WPF to make it better for more types of projects.
|
|
|
|
|
I suppose I would like to know what it is about your winform application that made WPF not a good fit. We personally don't have any WPF in the shop, but have two Silverlight applications. The primary one has several hundred views. Between the Silverlight UI layer and all supporting services, etc, there's roughly 1.2 million lines of code.
Personally I can't imagine writing it in HTML5/CSS/javascript. The loss of the power of XAML and the loss of strong typing all the UI code would make me cringe. Yes, XAML is a little more verbose than HTML, but crazy more powerful. Templates, binding, converters, etc. It's a markup language designed for building UIs, not a markup language for hyperlinking text. Whoever that it was a good idea to continue to dress up the pigs that are HTML and JavaScript have done our profession a huge disservice.
Someone should have come along years ago and said, "Hey, in theory all of this web development stuff is great, but we need to start with a clean slate" and made the languages that we needed. Personally, I would love to see C# native development cross platform, and XAML as a choice for UI.
As for WinForms, I've done my share. But, it seemed like significantly more work in WinForms to adopt patterns built for testing -- MVVM or MVC, dependency injection, etc. I did one WinForm app using PRISM back in the day, but it's no where near as elegant as what we could do in Silverlight.
|
|
|
|
|
I have similar feelings - Web technology ought to be more consistent and more powerful than JavaScript alone (not to say anything isn't possible in JavaScript, but thinking about effort invested). However, JavaScript is ideal for so many Web applications that don't require massive data processing. It is good for hobbyists and small businesses (like mine), as it is fairly easy, with HTML 5, to get cool things done. C# could never comfortably replace JavaScript in these functions as it is simply too heavy a tool to use for many purposes, even if it was truly cross-platform (and I wish it was). I have space on two servers, one using SQL and PHP, the other using .NET technology, but I find it easier to get most things done with the former. However, I anticipate that the .NET server would be more useful for processing large amounts of data or for running code which really requires more than a few thousand lines of script. Hence, I have plans to use it in the near future, initially for one specific project I have in mind. The same goes with all software - each language and framework has advantages in certain applications, which is why I have quite a wide spread of skills in different languages, but that makes me more a jack of all trades, than a master of any one (but that's OK because I am a hobbyist and so can afford to be a generalist).
|
|
|
|
|
I can vouch for this. MM
|
|
|
|
|
A while back I mentioned about the hubby (Jim) of one of my wife's friends who died of cancer at the hospice my wife works and he left three sets of golf clubs to me. I told his widow to ask his local club if they wanted a set which she passed on and they are used, I think, by the instructors there to teach golfing newbies. A second set was sold for about £450 or something like that. The third set was held at Wentworth where he'd been a member for over 35 years. Once his estate was wound up they contacted me when the clubs were released from their storage. I spoke to one of the club's officers and asked if it was possible to offer them for sale through the club's members network. Leave it to me, he said.
One of Jim's former hockey playing buddies who moved to Portugal came back over for a few weeks on business and met Jim's widow. He offered to buy the clubs and I asked her to give any money she got for them to the hospice. He collected the clubs before he left for Portugal. She gave me a call a couple of weeks ago to say he left, wait for it, £15,000 to the hospice for the clubs.
Obviously the clubs weren't worth anywhere near that value. The next time I have a beer, I will toast Jim for having the wisdom to leave them to someone (me) who he knew had no interest in the game at all and would probably be game to sell them on which I was. The sale of the two sets raised about £15,450 for the hospice.
My wife's only regret having nursed him there is that he passed away not too long before she started her early shift that day. He was a decent bloke and I learned he played hockey some 70 times for England in the 1950-1960s. There was more to the old boy than I never knew.
If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.
|
|
|
|
|
It is amazing..how you can know some one for years and not really know that much about them,
You go to a funeral and find out things you never knew. Like a friend of my Dads, Civil Engineer for the Railway, he died only at his funeral I found out he had been involved in the Spanish Civil war, D-Day (he got his forearm crushed on D-Day+2 by a wayward gun breech(6 pound antitank)), heavily anti-US since the Suez mess...
|
|
|
|
|