Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can WinForms and XAML not benefit from the same logic as CSS?

Can WinForms and XAML not benefit from the same logic as CSS?


It occurred to me this morning, as I was browsing some of my unanswered questions on Stackoverflow:

If you're not using FlowLayoutPanel or a TableLayoutPanel, to layout controls on your WinForm, you'll be accused of not doing it right.

This is in contrast with the (religious) debate in html world about CSS vs Tables.

It seems to me that the maintainability problems of a UI laid out with a table has been ported to WinForms. And with XAML, which can be thought of of a form of HTML, has embraced table based layouts. You'll have a hard time doing anything in XAML without using tables.

Can WinForms and XAML not benefit from the same logic as CSS? Can the maintenance problems of tables not be done away with? I realize accessibility isn't a problem on a WinForm or WPF form laid out using tables: the reader will not "see" the layout panel - so that's a problem in CSS that doesn't exist in WinForms.

But can't WinForms/XML benefit from non-table based layouts? I know I certainly don't want to have to move that "OK" button 3 dialog units to the left in a table-based approach.

like image 786
Ian Boyd Avatar asked Jan 23 '26 21:01

Ian Boyd


1 Answers

I don't think you can compare HTML and XAML. The implementation of table based layout (Grids) in XAML is far superior to that of HTML tables. There are far easier to work with and don't come with the same baggage that HTML tables do (cross-browser querks).

Also I don't agree with your comment ...

You'll have a hard time doing anything in XAML without using tables.

There are so many layout options in XAML, that you could produce an entire application without using a grid once. Though it may be easier to use Grids, it doesn't mean that you'd have a hard time using other layout elements. In fact, I use Stackpanels and Canvases as much as I do grids.

It just becomes a question of using the correct element for each scenario. Having come from web applications and been writing HTML and CSS for years, I find that XAML is a wonderful markup, that makes laying out your interface a breeze ... not to mention everything else that comes with XAML.

So to answer your question ... can XAML benefit from CSS logic? Yes and it does, MS has taken great things from CSS, but has also produced a superior markup.

like image 196
Chris Nicol Avatar answered Jan 25 '26 13:01

Chris Nicol