Desktop: WinForms, WPF, UWA
-
You can create your own controls if you need to.. WPF: how to make the selection item highlight color stay in the listBox even the listBox control loses the fucus?[^] Keeping the Selected Item Selected When Changing a ListView’s ItemsSource | Ben Gribaudo[^]
Caveat Emptor. "Progress doesn't come from early risers – progress is made by lazy men looking for easier ways to do things." Lazarus Long
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. :)
-
There are many reasons for this. Here are a few: 1. It's something that's of interest to enterprises because they can offload many of their apps to use this technology without rewriting; it makes distribution easier for them if they run their own enterprise version of the Microsoft AppStore (this is something I know that businesses are keen on). 2. It opens up the opportunity for Microsoft to vastly increase the amount of applications it can deliver from the app store (as well as increasing the target devices if they ever do manage to get a mobile version out the door). 3. As Microsoft charge a fee for serving apps from the app store, this increase gives them an opportunity to tap into a very lucrative market here.
This space for rent
-
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
-
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 theItemsControl
. I wrote a behavior to achieve this, which you can look at here: [SignalChat: WPF & SignalR Chat Application](https://www.codeproject.com/Articles/1181555/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. :thumbsup:
-
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 withFont
, it will look horrible. If you go withDpi
, 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 withNone
. Now, add to that theAnchor
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 :D 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.
-
WPF and UWP are, one way or another, getting closer together with the formulation of XAML Standard. In a year or so, this will generalize XAML to the point that UWP, WPF, Xamarin.Forms (and Unity3D assets like NoesisGUI) will all work with the same basic XAML. Add that to the steady evolution of WebAssembly, and you'll end up with local HTML clients running C# and XAML somewhere around Q4/2018-Q1/2019.. if nothing goes horribly wrong. My money is on UWP and WPF devs eventually migrating to HTML5/electron running C# with some iteration of XAML Standard. At that point, the boundaries between web and desktop apps will be gone, and everything else can be deprecated. :cool:
-
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.
-
WinForms, or better, the Common Controls, are very underappreciated; it is a mature product. A standard that is not just available on Windows anymore, as WinForms work just as happily under Linux. I'm sure that WPF is better for graphics, as advertised. I build tools for people that work. They don't care about flashy, they care about reliability and predictability. I'm not paid for animated borders, but functionality - and will probably still be maintaining WinForms code by the time that our great overloads predicted that AI will write code.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
Eddy Vluggen wrote:
I build tools for people that work. They don't care about flashy, they care about reliability and predictability. I'm not paid for animated borders, but functionality - and will probably still be maintaining WinForms code by the time that our great overloads predicted that AI will write code.
Absolutely agree. I’ve played with some of the newer GUI technologies myself and keep finding that the mature WinForms technology is the way to go. It might not be considered “flashy” but sure is reliable and gets the job DONE.
If you think hiring a professional is expensive, wait until you hire an amateur! - Red Adair
-
Recently, I had an interesting discussion with another CPer who took umbrage with my recent article which summarized a shift from WinForms directly to UWA/UWP XAML and ignored WPF XAML. I mentioned that WPF was indeed ignored by vast numbers of devs and that no shop I've worked in ever paid it more than scant attention. I also mentioned that many devs seemed to (perhaps improperly) connect WPF with Silverlight and MS killed Silverlight in the quiet of the night and many devs never felt much motivation to go to WPF. Not Reviving A Debate Or Anything Against WPF-minded CPer Of course, WPF is used all around, I'm sure. This post is not an attempt to revive a debate that ended up being a very good discussion. I think the CPer was definitely correct on many things he said. My point is the following (and I think it is interesting): Trying To Find XAML Control Solutions: Difficult Today, 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 -- keep it highlighted. Could Only Find WinForms Answers As I searched I could find nothing but WinForms answers about how to do that. Those answers are like 7 years old. Should Be Very Simple and Is In WinForms The answer should be very simple. WinForms Answer : In WinForms the answer is set the HideSelected property to false. This is something that is an obvious functionality in a ListView. So obvious that WinForms provided a property. Not so in XAML. Hmmm... Disclaimer Yes, I am a newbie to XAML and someone will surely post the answer to how to do this in XAML as soon as I post. Feels Like Microsoft Never Fully Developed XAML Either This kind of thing makes me feel like Microsoft never carried out the XAML development all the way either. Just thought it was very interesting. How about you? EDIT I also own this book Universal Windows Apps with XAML and C# Unleashed [
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 b
-
All very good explanations for that. Of course, it is all about the $$$$. Interesting to think about Corporations pay to deploy apps to their own machines. :|
raddevus wrote:
Interesting to think about Corporations pay to deploy apps to their own machines.
No, they won't be - they'll be hosting their own private app store. They'll license that from Microsoft.
This space for rent
-
raddevus wrote:
Interesting to think about Corporations pay to deploy apps to their own machines.
No, they won't be - they'll be hosting their own private app store. They'll license that from Microsoft.
This space for rent
-
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 b
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.:thumbsup:
-
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 b
> 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... :laugh:
-
Recently, I had an interesting discussion with another CPer who took umbrage with my recent article which summarized a shift from WinForms directly to UWA/UWP XAML and ignored WPF XAML. I mentioned that WPF was indeed ignored by vast numbers of devs and that no shop I've worked in ever paid it more than scant attention. I also mentioned that many devs seemed to (perhaps improperly) connect WPF with Silverlight and MS killed Silverlight in the quiet of the night and many devs never felt much motivation to go to WPF. Not Reviving A Debate Or Anything Against WPF-minded CPer Of course, WPF is used all around, I'm sure. This post is not an attempt to revive a debate that ended up being a very good discussion. I think the CPer was definitely correct on many things he said. My point is the following (and I think it is interesting): Trying To Find XAML Control Solutions: Difficult Today, 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 -- keep it highlighted. Could Only Find WinForms Answers As I searched I could find nothing but WinForms answers about how to do that. Those answers are like 7 years old. Should Be Very Simple and Is In WinForms The answer should be very simple. WinForms Answer : In WinForms the answer is set the HideSelected property to false. This is something that is an obvious functionality in a ListView. So obvious that WinForms provided a property. Not so in XAML. Hmmm... Disclaimer Yes, I am a newbie to XAML and someone will surely post the answer to how to do this in XAML as soon as I post. Feels Like Microsoft Never Fully Developed XAML Either This kind of thing makes me feel like Microsoft never carried out the XAML development all the way either. Just thought it was very interesting. How about you? EDIT I also own this book Universal Windows Apps with XAML and C# Unleashed [
Feature for feature, WPF has more to offer than Windows Forms; except maybe for the "Open / save", etc. common dialogs. You fail to find an answer to you "obvious" question, and therefor discount the entire platform. Funny thing is, I'm currently looking at a panel which has multiple ListViews with GridViews inside a WrapPanel, and ALL the ListViews are showing the "items that lost focus" as having a "different hilite" than the ones that were not selected. Looking at other implementations, they ALL show the item that "lost focus". And I did "nothing" to activate that functionality. Maybe that's why there are no "articles". Default behaviour out-of-the-box (if you don't override it; like one of the "system colors").
"(I) am amazed to see myself here rather than there ... now rather than then". ― Blaise Pascal
-
:laugh: Is that an analogy for inbred? :-)
Nish Nishant Consultant Software Architect Ganymede Software Solutions LLC www.ganymedesoftwaresolutions.com
Nish Nishant wrote:
Is that an analogy for inbred?
No, more of a single voter issue analogy. ;)
Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802
-
Nish Nishant wrote:
Is that an analogy for inbred?
No, more of a single voter issue analogy. ;)
Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802
Ah, okay. I over thought it :)
Nish Nishant Consultant Software Architect Ganymede Software Solutions LLC www.ganymedesoftwaresolutions.com
-
Recently, I had an interesting discussion with another CPer who took umbrage with my recent article which summarized a shift from WinForms directly to UWA/UWP XAML and ignored WPF XAML. I mentioned that WPF was indeed ignored by vast numbers of devs and that no shop I've worked in ever paid it more than scant attention. I also mentioned that many devs seemed to (perhaps improperly) connect WPF with Silverlight and MS killed Silverlight in the quiet of the night and many devs never felt much motivation to go to WPF. Not Reviving A Debate Or Anything Against WPF-minded CPer Of course, WPF is used all around, I'm sure. This post is not an attempt to revive a debate that ended up being a very good discussion. I think the CPer was definitely correct on many things he said. My point is the following (and I think it is interesting): Trying To Find XAML Control Solutions: Difficult Today, 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 -- keep it highlighted. Could Only Find WinForms Answers As I searched I could find nothing but WinForms answers about how to do that. Those answers are like 7 years old. Should Be Very Simple and Is In WinForms The answer should be very simple. WinForms Answer : In WinForms the answer is set the HideSelected property to false. This is something that is an obvious functionality in a ListView. So obvious that WinForms provided a property. Not so in XAML. Hmmm... Disclaimer Yes, I am a newbie to XAML and someone will surely post the answer to how to do this in XAML as soon as I post. Feels Like Microsoft Never Fully Developed XAML Either This kind of thing makes me feel like Microsoft never carried out the XAML development all the way either. Just thought it was very interesting. How about you? EDIT I also own this book Universal Windows Apps with XAML and C# Unleashed [
As a caveat, what works for me does not necessarily work for others. That said... For quick and dirty little utilities, I still use WinForms. But not for projects beyond personal use and little complexity. WinForms can do the large and complex, but that is not my preference. I use UWP as part of Xamarin.Forms development. While the Android and iOS projects are targeted to phones and tablets, the UWP project extends my program to Windows tablets, laptop, and desktops. I suspect as I get more proficient with XAML, and hopefully MS/Xamarin get over their cranial-anal inversion on a XAML designer that works with Xamarin.Forms projects, WinForms will no longer be my choice for the little one-off utility programs I do.
-
WinForms, or better, the Common Controls, are very underappreciated; it is a mature product. A standard that is not just available on Windows anymore, as WinForms work just as happily under Linux. I'm sure that WPF is better for graphics, as advertised. I build tools for people that work. They don't care about flashy, they care about reliability and predictability. I'm not paid for animated borders, but functionality - and will probably still be maintaining WinForms code by the time that our great overloads predicted that AI will write code.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
The big problem with winforms apps we did at my old job was that the native controls all played badly with DPI scaling; a situation made much worse if you had any custom layout code/custom paint code that had an implicit assumption of no scaling in its math and got totally hosed up if you bumped the scaling levels. Dunno if MS has made the situation better in Win8/10 than it was in 7 or otherwise in common libraries over the last 2 years or so. It never got past the list of things we were floating to our govt customer as potential upgrades/an internal pain point for anyone using scaling normally. My new job has WPFed for any desktop apps we do for DPI scaling among other reasons; needing to support older versions of windows means that UWP is a non-starter.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies. -- Sarah Hoyt
-
Eddy Vluggen wrote:
I build tools for people that work. They don't care about flashy, they care about reliability and predictability. I'm not paid for animated borders, but functionality - and will probably still be maintaining WinForms code by the time that our great overloads predicted that AI will write code.
Absolutely agree. I’ve played with some of the newer GUI technologies myself and keep finding that the mature WinForms technology is the way to go. It might not be considered “flashy” but sure is reliable and gets the job DONE.
If you think hiring a professional is expensive, wait until you hire an amateur! - Red Adair
ClockMeister wrote:
...is reliable and gets the job DONE
And in the end, that's what keeps developers in business. I only write apps for my own use and occasionally a CP article. But everything is Winforms. As the old saying goes, "it just works."
Sometimes the true reward for completing a task is not the money, but instead the satisfaction of a job well done. But it's usually the money.
-
ClockMeister wrote:
...is reliable and gets the job DONE
And in the end, that's what keeps developers in business. I only write apps for my own use and occasionally a CP article. But everything is Winforms. As the old saying goes, "it just works."
Sometimes the true reward for completing a task is not the money, but instead the satisfaction of a job well done. But it's usually the money.
The thing about it is that WinForms applications aren't ugly, the data presentation can be very attractive and meaningful. In my case I've found that having a GUI so well worked out lets me focus on the problem-at-hand instead of spending all my time struggling to get the GUI working right. I have a web-based version of program I wrote for WinForms, it's fun to hack on from time-to-time but just getting the output right consumes a lot more time. I am certainly not against web-based presentation if needed, however if a WinForms application can do the job, the performance is far better and results very consistent. As for WPF (or any of the other cute technologies for desktop GUI) ... it's "hand waving" as far as I'm concerned.
If you think hiring a professional is expensive, wait until you hire an amateur! - Red Adair