Poll: WinForms vs. WPF/XAML.... Which one(s) do *you* use???

This forum is meant for questions and discussions about the X# language and tools
Post Reply
Anonymous

Poll: WinForms vs. WPF/XAML.... Which one(s) do *you* use???

Post by Anonymous »

As a newcomer to X#, I'm trying to get a feel as to which UI solution most of the X# developers are using for there applications?

Is it like 70% WinForms and 30% WPF/XAMPL? Something like that?

Please help me understand...
User avatar
lumberjack
Posts: 727
Joined: Fri Sep 25, 2015 3:11 pm
Location: South Africa

Poll: WinForms vs. WPF/XAML.... Which one(s) do *you* use???

Post by lumberjack »

Winforms 100% here
______________________
Johan Nel
Boshof, South Africa
TerryB1
Posts: 306
Joined: Wed Jan 03, 2018 11:58 am

Poll: WinForms vs. WPF/XAML.... Which one(s) do *you* use???

Post by TerryB1 »

Hi Matt

I am not in a position to answer exactly what you asked. (I'm a C-Sharper looking in).

Having said that I have no hesitation is saying "get to grips with WPF as soon as you can". It is the future
and will allow you to target the widest range of display hardware automatically.

It is something that is probably new to you - if you have WinForms stuff that you need to get out to users, then you may find that quicker.

The thing you have to remember with WPF is the approach - every control works on the basis of "calculate the size required, then put the data in". That is a logical way to do things if you think about it.

As you get into XSharp you need to think - not only is it bringing you into the .Net world but at the same time it is the path to the future.

HTH

Terry
George
Posts: 106
Joined: Thu Nov 05, 2015 9:17 am

Poll: WinForms vs. WPF/XAML.... Which one(s) do *you* use???

Post by George »

WinForms.

WPF only for integrating Bing Maps in a WinForms App.
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Poll: WinForms vs. WPF/XAML.... Which one(s) do *you* use???

Post by wriedmann »

Hi Matt,

WPF whereas possible, but written in code, not XAML.
WPF is very powerful, and with own control classes you have a lot of power.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Poll: WinForms vs. WPF/XAML.... Which one(s) do *you* use???

Post by ic2 »

WPF. Not because I'm a fan -on the contrary- but because it's the most flexible (in the end).
I try to use the XAML editor as much as possible but that is often difficult as you can not move controls to where you expect due to all kinds of restraints within stackpanels, grids, etc.
Advantage is that you can just copy and paste some XAML code from the internet to get a specific look and feel in the complete window, or just how a button should look.

Disadvantage is that the WPF designers apparently never heard of Winforms in their whole life when they created WPF. So sometimes you see a code snippet for a control and this only works on Winforms (Same control). Or the other way around. They also forgot some important controls, like a window to select a directory including the option to type the name yourself. That can still be realized within WPF...with Winforms. Which, I must admit, makes one think ...why didn't I choose Winforms in the first place....

Another reason for me for WPF is that it's the only way when you want to create UWP programs. I created a few (in C#).

Dick
NickFriend
Posts: 248
Joined: Fri Oct 14, 2016 7:09 am

Poll: WinForms vs. WPF/XAML.... Which one(s) do *you* use???

Post by NickFriend »

WPF all the way, but I'd strongly advise to invest in a good set of UI components. I use the DevExpress WPF control set, and it's fabulous, but there are other options like Infragistics and Telerik as well. WPF is amazingly flexible, but can be a slog if you try to do everything yourself - which is where the commercial control set comes in.

The other thing about WPF is it leads you naturally to the MVVM pattern of programming, which is also another massive step forward in terms of app design.

Nick
FoxProMatt

Poll: WinForms vs. WPF/XAML.... Which one(s) do *you* use???

Post by FoxProMatt »

Wolfgang - any short code samples you can post which show creating XAML objects in code, rather than the actual XAML markup?
User avatar
lumberjack
Posts: 727
Joined: Fri Sep 25, 2015 3:11 pm
Location: South Africa

Poll: WinForms vs. WPF/XAML.... Which one(s) do *you* use???

Post by lumberjack »

Hi Matt,
FoxProMatt_MattSlay wrote:Wolfgang - any short code samples you can post which show creating XAML objects in code, rather than the actual XAML markup?
Under Help, Phil Hepburn's eNotes. Download
______________________
Johan Nel
Boshof, South Africa
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Poll: WinForms vs. WPF/XAML.... Which one(s) do *you* use???

Post by wriedmann »

Hi Matt,

if you are XIDE: New application - Samples and take WPF Simple App and then the WPF Enhanced App.
These samples are a contribution of myself.
It is really simple, but a lot of code, if you are using the base classes:

Code: Select all

oGrid := Grid{} 
oGrid:ColumnDefinitions:Add( ColumnDefinition{} )
oGrid:ColumnDefinitions:Add( ColumnDefinition{} )
oGrid:RowDefinitions:Add( RowDefinition{} )
oGrid:RowDefinitions:Add( RowDefinition{} )
oGrid:RowDefinitions:Add( RowDefinition{} )
	
oLabel := Label{}
oLabel:Content := "Label 1"
oLabel:Name := "Label1" 
oLabel:Margin := oMargin
oLabel:Height := nHeight
Grid.SetRow( oLabel, 0 )	
Grid.SetColumn( oLabel, 0 )	
oGrid:Children:Add( oLabel )
	
oTextBox := TextBox{}
oTextBox:Text := ""
oTextBox:Name := "TextBox1"
oTextBox:Margin := oMargin
oTextBox:Height := nHeight
Grid.SetRow( oTextBox, 0 )	
Grid.SetColumn( oTextBox, 1 )	
oGrid:Children:Add( oTextBox )
But if you have learned OOP <g> then you will find a better solution, very quickly: define own control classes.
And then it looks so:

Code: Select all

oGrid := WPFGrid{ 2, 3 }
	
oLabel := WPFLabel{ "Label1", "Label 1" }
oLabel:Margin := oMargin
oLabel:Height := nHeight
oGrid:AddControl( oLabel, 0, 0 )
	
oTextBox := WPFTextBox{ "TextBox1" }
oTextBox:Margin := oMargin
oTextBox:Height := nHeight
oGrid:AddControl( oTextBox, 1, 0 )
And then you can try to look at the MVVM samples - they show a name based binding like in VO.

Of course, feel free to ask!

Wolfgang
P.S. I'm not a friend of painters, and WPF is so dynamic that you have to re-think your windows: how should they adapt itself to changing screen sizes
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply