Discussion:
GTK# Fails The XAML Test
Gerald Bauer
2004-08-15 21:23:58 UTC
Permalink
Hello,

Marc Clifton looked into creating GTK# UIs using MyXAML running
under Mono.

Marc writes:

I eventually got Visual Studio to compile and run a GTK# application
(sans MyXaml). This was an arduous task in itself as the "how to" in
the above article falls far short of the reality needed to get things
working. I'll probably write an article on how to do it.

So, the next step was, OK, can XAML be used to instantiate a GTK#
object graph? Sadly, the answer is no. I haven't done a lot of
exploring, but I found two showstoppers right away.

First, there is no default Window constructor. This breaks the first
law of XAML compliant classes--you must have a parameterless
constructor. OK, maybe this can be handled in the markup some day,
but right now, no. And frankly, I think it's bad form to not support
a parameterless constructor.

Second, (and a very disappointing surprise) is how collections are
handled. Take the Window class again. It's derived from Container.
OK, well, Container has an Add() method. There is no "Items" property
or similar implementation derived from something like IList or
ICollection. One would be able to live with that if they used their
own I... collection interface, but sadly no. And the real nail in the
coffin is the read-only "Children" property, which simply returns an
array. Not an Array object, but a straight forward array.

In order words, you have to use the Add method. Even the Add method
is dubious, as the documentation suggests that you should consider
using functions such as Gtk.Box.Packstart and Gtk.Table.Attach as an
alternative because Add will use default packing parameters that may
not be correct.

So, the conclusion is that GTK# needs to get on board with XAML
compliance before it's useful as an alternative UI for declarative
markup parsers. And after spending the good part of the morning
researching all of this, I have a much better appreciation for the
great job that the Microsoft folks did on .NET. Makes me wonder if
they had a vision of XAML from the beginning, or were we all just
lucky because the .NET framework had to be written in a specific way
to support the serialization of UI into C#/VB, etc.

Anyways, now I'm wondering whether the GTK# folks have any interest in
making their library XAML compliant. As it stands now, GTK# is not
usable for serializing/deserializing object graphs into XML with a
generic parser. You'd have to write a GTK# custom parser.

Source: http://myxaml.com/marcclifton/archive/2004/08/15/433.aspx

- Gerald

-------------------
Gerald Bauer

XUL Alliance | http://xul.sourceforge.net
United XAML | http://xaml.sourceforge.net

Interested in hiring Gerald Bauer? Yes, I'm available.
If you know of an opportunity in Toronto or Vancouver, please contact
me today.



------------------------ Yahoo! Groups Sponsor --------------------~-->
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->


Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/xaml-talk/

<*> To unsubscribe from this group, send an email to:
xaml-talk-***@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/

Loading...