Page 1 of 1
Poll: WinForms vs. WPF/XAML.... Which one(s) do *you* use???
Posted: Tue Apr 09, 2019 5:37 pm
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...
Poll: WinForms vs. WPF/XAML.... Which one(s) do *you* use???
Posted: Tue Apr 09, 2019 5:56 pm
by lumberjack
Winforms 100% here
Poll: WinForms vs. WPF/XAML.... Which one(s) do *you* use???
Posted: Tue Apr 09, 2019 6:12 pm
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
Poll: WinForms vs. WPF/XAML.... Which one(s) do *you* use???
Posted: Tue Apr 09, 2019 6:47 pm
by George
WinForms.
WPF only for integrating Bing Maps in a WinForms App.
Poll: WinForms vs. WPF/XAML.... Which one(s) do *you* use???
Posted: Tue Apr 09, 2019 6:58 pm
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
Poll: WinForms vs. WPF/XAML.... Which one(s) do *you* use???
Posted: Tue Apr 09, 2019 7:17 pm
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
Poll: WinForms vs. WPF/XAML.... Which one(s) do *you* use???
Posted: Tue Apr 09, 2019 7:45 pm
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
Poll: WinForms vs. WPF/XAML.... Which one(s) do *you* use???
Posted: Tue Apr 09, 2019 8:28 pm
by FoxProMatt
Wolfgang - any short code samples you can post which show creating XAML objects in code, rather than the actual XAML markup?
Poll: WinForms vs. WPF/XAML.... Which one(s) do *you* use???
Posted: Tue Apr 09, 2019 8:57 pm
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
Poll: WinForms vs. WPF/XAML.... Which one(s) do *you* use???
Posted: Wed Apr 10, 2019 5:57 am
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