|
Hi, Raddevus,
As someone who has spent far too much time wrestling with the quirks of the MS supplied WinForm Controls ... many of which are .NET wrappers around old COM.ActiveX Controls ... I have a less "rosy" view of them: imho, they are a herd of cats
From the "cup is half-full" perspective, you could say that MS enabled a market for 3rd. party control developers to create much more powerful and internally consistent controls, with consistent API's. I remember, so well, my elation when I discovered Andrej Stojkov's Lidor TreeView Control: felt like I had gotten out of jail
I was excited, initially, by WPF's promise of an all-vector rendering engine, bubbling event-model, superior binding facility, etc. And, of course, symbiosis with a web-stack, SilverLight.
There was some great work done here, on CP, by pioneers like Clifton, Adrian Alexander, O'Hanlon, Josh Smith, Sacha Barber, and others.
The reality of programming in Visual Studio with WPF, however, just was not right ... for me.
Then, came the debacle of Metro, the deprecation of SilverLight, the failure of Metro, MS VP Sinofsky's (Metro honcho) departure, the WinRT hoop-la, etc. A lot of devs felt burned; fence-sitters, like me, decided to stick with WinForms.
If only ... one can waste time fantasizing about ... WinForms had a retained-mode all-vector, 2d graphic engine, and WPF's event and binding facilities. A Designer.cs file-format that at least was more XML-like, or, even XAML like.
A few comments:
1. For WinForms TreeView and ListView that would be the 'HideSelection Property.
2. There is a more recent (2016) 2nd. ed. version of Nathan's book for Windows 10: [^], but it's listed as unavailable on Amazon, currently.
«While I complain of being able to see only a shadow of the past, I may be insensitive to reality as it is now, since I'm not at a stage of development where I'm capable of seeing it.» Claude Levi-Strauss (Tristes Tropiques, 1955)
modified 13-Dec-17 21:42pm.
|
|
|
|
|
Really like your summary of the situation because that is my experience too.
I've been using those old controls since Win3.1 -- okay Win95 --- okay I guess they get updated once in a while but it seems like those are the same controls we've been working with since Win95 and you're right there is plenty about them that is bad / crufty / cracked.
But, since we've been working with them for 20 years we know how to get around those things.
I remember about the time Vista released I started messing around with WPF / XAML and wasn't that impressed seemed like a bunch of stuff to learn to draw my own controls when I could more easily drop a windows treeview on a WinForm app and be done. I'm no graphic artist so I let the TreeView be a TreeView.
Then the Silverlight debacle and all the rest just as you said.
Now Microsoft does the head-fake to UWP. I start learning XAML again and it is pretty cool.
But then you go to look for these things that must surely be easy even in XAML since people have been doing WPF / XAML, right? But you can't find the answers? It's all just crazy.
EDIT
Also, it is very interesting that the author changed that book's name to Building Windows 10 Apps from the previous name of Universal Windows Apps.
Makes me feel like Microsoft whispered in his ear something like,
"Uh, we're backing off the whole UWP/UWA thing, so..." ugh!
|
|
|
|
|
Just my $.02:
WinForms are really easy. And I mean, REALLY easy, I've enjoyed using them for years.
The click for me, when going to WPF, is: 4K monitors. If your resolution is high-res (such as, for 4K), WinForms are taking a really big fall. About close to 2 years ago, I got a laptop with 4K resolution. At this point, things starting to go downfall. What you see in the VS designer, is not what you will see visually. Some of the controls you create will look incredibly messy. The AutoScaleMode : if you go with Font , it will look horrible. If you go with Dpi , sometimes it's decent, sometimes not - what I've found is that most of the time, as long as I keep the form/control under 1900x1080, it's ok; and as a side-note, never go with None .
Now, add to that the Anchor property - which I used heavily to properly align controls. It seldom works on high resolution monitors.
What you end up is pretty much "try to see if it works". And "if" it works, you need to then test at other resolutions. So, long story short, as monitors get higher and higher res, WinForms is losing ground.
Now, onto WPF - really steep learning curve, but the results can be amazing. A lot of things will once again be "trial and error" at first, but once you get the hang of it, and if you have some pretty fancy UI in mind, WPF can definitely help you there. That, and Resharper
Best,
John
-- Phot-Awe - Find the Photos you Love - FAST!
|
|
|
|
|
Great post and info.
John Torjo wrote: Now, add to that the Anchor property - which I used heavily to properly align controls. It seldom works on high resolution monitors.
I suffered this problem with my winforms when the new higher resolution and wide screens came out.
|
|
|
|
|
Thanks
One other issue I just remembered - sometimes, when lots (I mean, LOTS) of controls on a dialog/usercontrol, the VS2013 designer crashes a lot of times - so, editing the dialog/usercontrol is a huuge pain. I would have expected this to be solved later on (VS2017), but turns out this is not the case.
Best,
John
-- Phot-Awe - Find the Photos you Love - FAST!
|
|
|
|
|
John Torjo wrote: VS2013 designer crashes a lot of times
Yeah, I've run into this problem also in VStudio 2017 and didn't even have a large number of controls.
|
|
|
|
|
As I get older all my skill declines..
For example after reading your message a few times I fail to see your point.. is it a question? (about what?) a statement? (for whom?)...
Glad you play with XAML anyway. XAML is great!
Other than that WPF is great! Ever heard of Visual Studio? It's a WPF application ya know!
But not many people write desktop application these days, that's why WPF is kind of neglected...
|
|
|
|
|
|
abmv wrote: You can create your own controls if you need to..
That is good...I know I should feel like that is good.
But when you are spoiled by WinForms development and you drag and drop the control and it "Just works" it's difficult to be excited by that.
|
|
|
|
|
Quote: But when you are spoiled by WinForms development and you drag and drop the control and it "Just works" it's difficult to be excited by that. I work in WinForms with a team that requires ease of maintenance over innovation. Being a 20+ yr. programmer, I have learned that getting deeper into whatever you are using generates more functionality than any shiny new tech you learn from scratch. That doesn't mean that a better way of building things is ignored, just that you learn to sift value gained vs effort spent.
|
|
|
|
|
Well its up to you..besides there are a number of third party WPF controls available in the
market if you don't have the time to do the development esp if you are building a LOB application.
Caveat Emptor.
"Progress doesn't come from early risers – progress is made by lazy men looking for easier ways to do things." Lazarus Long
|
|
|
|
|
I have used WPF outside on my personal projects and as has been said before WPF makes the simple complicated and the complicated simple.
My experience is that it's a bit like doing web development - it can be a real PITA but when done right gives you something nice to look at... and that's pretty much what it comes down to - you can create 'nice' custom controls and it encourages loose coupling of the data and the UI.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
GuyThiebaut wrote: WPF makes the simple complicated and the complicated simple
That's a perfect explanation of the situation.
That's a perfect quote for everything Microsoft is doing now, it seems.
|
|
|
|
|
Come to think of it... I think you have a good point
What I describe does indeed pervade most of what Microsoft does and in fact most of IT nowadays.
What I see happening where I work is that the young-uns actually admit that the only reason they introduce new frameworks into the business is to improve their cv.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
GuyThiebaut wrote: the only reason they introduce new frameworks into the business is to improve their cv.
Yep. That nails it.
|
|
|
|
|
raddevus wrote: I was looking for a way to make sure my UWA (XAML-based) app's ListView would show the last selected item even when it lost focus I'm not well versed in UWA matters but in WPF using a behavior would be one route you could take. Maybe not exactly what you're trying to achieve, but when working on a SignalR-WPF chat application I needed new items added to an ItemsControl to scroll into view, which is not the default behavior of the ItemsControl . I wrote a behavior to achieve this, which you can look at here: SignalChat: WPF & SignalR Chat Application.
"As beings of finite lifespan, our contributions to the sum of human knowledge is one of the greatest endeavors we can undertake and one of the defining characteristics of humanity itself"
|
|
|
|
|
That's a very nice article and a nice explanation of that behavior.
I will look at that more closely.
I was wondering if it would be a behavior which I find interesting since it feels like this simple thing takes a bit more processing power -- observing an event, instead of the thing just getting set and forgetting about it.
Thanks very much.
|
|
|
|
|
We started to work with WPF and MVVM years ago and I am very astonished that people still use WinForms. WPF/MVVM really does everything we need (for our standard product for company users). And I never found it difficult to get other developers' advice and examples for WPF.
We also have some UPW apps in the store, but I cannot find companies working with them.
Btw, I understood, that UWP is based on .Net Core and therefore will survive, when the Win32 kernel will die.
|
|
|
|
|
raddevus wrote: Just thought it was very interesting. How about you?
I'd rather deal with the quirks of HTML than WPF, which I won't tell you what it reminds me of every time I try to use it. Think Alabama voters and why they don't vote Democratic (usually.)
|
|
|
|
|
Is that an analogy for inbred?
|
|
|
|
|
Nish Nishant wrote: Is that an analogy for inbred?
No, more of a single voter issue analogy.
|
|
|
|
|
Ah, okay. I over thought it
|
|
|
|
|
I moved over to WPF a number of years ago simply because it had been touted as the technology to replace WinForms.
To me WPF biggest advantage is that you can program it in similar style to that of an ASP.NET WebForms application. However, this is about its only real big advantage.
WPF documentation is notoriously fragmented, and in some cases just downright bad.
The complexity in developing a nice interface with WPF is terrible. And like ASP.NET MVC, forces developers to take on more complexity than is actually needed.
Having to rework templates for a single control simply to have it work in a manner consistent with how you may want it to work with your application is beyond ridiculous. And the time-worn excuse that WPF is designed to be highly flexible as a result, is pathetic. On average, how many developers really require such flexibility. I have never seen a need for it in my career.
The problem is that Microsoft is still trying to set trends instead of maintaining mature platforms that have made it very easy for developers to build and implement applications. As a result, you have gotten such implementations such as ASP.NET MVC, WPF (with all the complexity), and LocalDB (supposedly to replace SQL Server CE).
Though I believe that WPF would have seen many more developers gravitate towards it had Microsoft streamlined its interface design with less complexity, they don't seem to be interested in refining this development environment. The form designer is still terrible in that you cannot accurately gauge where anything will actually show up as with the WinForms designer.
My complaint about a lot of this can be encapsulated around LocalDB. Though an excellent refinement for SQL Server Express it can hardly be seen as a real replacement for SQL Server CE, probably the finest desktop database ever produced to date.
SQL Server CE served a very specific purpose for those developers concentrating on the desktop. And as of a recent Microsoft survey (I believe), 46% of all development, despite all the hype is still for the desktop. With a few refinements, SQL Server CE would have been a snap to deploy and would have remained the desktop database of choice for a long time.
Instead, with the new directions of Microsoft under Nadella, who like all technology idiots with a "vision", he is enamored with cloud computing, which was a major factor in SQL Server CE's demise. Instead of offering both, SQL Server CE is simply removed from the product lineup. At the very least it could have been Open Sourced to a third party.
True, LocalDB can be used with desktop applications but it is a far larger implementation. To avoid user intervention during an installation process one has to set up their installation with a silent install. If you want to control any of the features of LocalDB from your application (beyond data access) you have to use a "Process.Start" method to run the "SqlLocalDB" utility to create instances, databases and the whatnot.
The idea of on-demand servicing, where LocaldDB remains dormant until a call is made for a request is rather ridiculous, considering that it will then only stay active for several minutes at a time.
With this milieu, Microsoft now claims this is a great database for developers and desktop applications. I would like to know how, when SQL Server Express is a snap to set up and SQL Server CE avoided a lot of the LocalDB issues.
Thinking like this is why WPF is a great way to program but a painful implementation to deal with...
Steve Naidamast
Sr. Software Engineer
Black Falcon Software, Inc.
blackfalconsoftware@outlook.com
|
|
|
|
|
Steve Naidamast wrote: Having to rework templates for a single control simply to have it work in a manner consistent with how you may want it to work with your application is beyond ridiculous.
Steve Naidamast wrote: WPF documentation is notoriously fragmented, and in some cases just downright bad.
Steve Naidamast wrote: The form designer is still terrible in that you cannot accurately gauge where anything will actually show up as with the WinForms designer.
These are all the exact things I was thinking as I wrote my original post.
The designer where you have to see XAML and Design View takes up so much space, controls are often invisible --- no borders or anything show up.
Documentation is extremely fragmented!!
All great points and reasons that XAML dev never really took off like it should've.
And, yes, desktop development is still a huge part of ongoing development in the Enterprise (where most money is probably dedicated to development too) and yet everyone is so (supposedly) focused on web apps, cloud, etc.
It doesn't add up.
Thanks for a great post.
|
|
|
|
|
Steve Naidamast wrote:
The form designer is still terrible in that you cannot accurately gauge where anything will actually show up as with the WinForms designer.
I admit the form designer in WPF sucks that way. I happen to love setting up grids in xaml to get everything precisely where I want it without having to drag and drop. I may be weird...
|
|
|
|
|