tags:

views:

168

answers:

4

How can I create automatic GUI using XML file in C#? Should I write a parser for the file and define a sort of "protocol" for the file's structure, and after the parse - create the GUI controls manually (respective to the data in the files)?

Or is there a better way? Is there a tool, or a built-in code in the .NET environment which can do that for me automatically?

(I am currently working with win forms, but I am willing to consider any other technology - as long as it's supported in MONO, since the code should be portable to Linux as well).

A: 

WPF uses xml to define most things, it's known as xaml.

Paul Creasey
+4  A: 

Glade is a RAD tool to enable quick & easy development of user interfaces for the GTK+ toolkit and the GNOME desktop environment.

The user interfaces designed in Glade are saved as XML, and by using the GtkBuilder GTK+ object these can be loaded by applications dynamically as needed.

By using GtkBuilder, Glade XML files can be used in numerous programming languages including C, C++, C#, Vala, Java, Perl, Python,and others.

I've used glade with C# and I was pleased with the result. Glade probably won't suit you directly, but you can at least borrow some ideas from it.

Bozhidar Batsov
A: 

"Is there a tool, or a built-in code in the .NET environment which can do that for me automatically?"

There are various wrappers for .NET around XULRunner on code.google.com

Andrei Taptunov
+1  A: 

If you're going to use XML, then you should really know about XML schemas - these are XML files that describe the content of an XML file and DevStudio (and other editors) can read them and do autocompletion, which is useful. Also, you can validate an XML against a schema to ensure the content contains no structural errors.

Also, as Paul wrote, XAML is an XML system, but you'd need to use WPF framework to parse it.

Skizz