Groups | Blog | Home
all groups > dotnet xml > october 2005 >

dotnet xml : Dynamic UI - Win Forms


Krishnan
10/6/2005 3:33:59 PM

Hi,
Sorry if this is a cross-post.

Wondering if there is any way to genrate Windows UI from an xml file just as
one would load a Web UI as HTML from an XML using XSLT. Please do let me
know if you have any ideas. Assume that the xml contains UI info (i.e.,
which is the control to display the info on etc). One obvious, but tedious
way is to manually parse the xml and generate controls using new() and fill
in data, but am looking for more structured ones.

TIA
Krishnan

Thanks
Krishnan

v-jetan NO[at]SPAM online.microsoft.com (
10/7/2005 7:52:17 AM
Hi Krishnan,

Thanks for your post.

Based on my understanding, you want to dynamically serialize and
deserialize the winform controls from Xml file.

Microsoft has released a KB of a sample project, which demonstrate the
VS.net IDE design-time support. In this sample, we can serialize the
designer in 3 formats: VB.net files, C# files and Xml files. It also
implemented the function of deserialize the designer from Xml files. So
this function may meet your need.

Normally, internally, it just parse the xml file and use Reflection to
create each controls and initialize each properties. Link listed below:
"INFO: Code Sample That Demonstrates How to Create a Custom Form Designer
by Using Visual C# .NET"
http://support.microsoft.com/default.aspx?scid=kb;en-us;813808

Hope this helps

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Krishnan
10/7/2005 2:48:44 PM
Hi,
Thanks for your reply.

I was more concerned about a dynamic UI. Foe e.g., if I have an xml file
that contains (among other things) data and the control through which I
should display data, I should be able to do it in Winforms. (In case of an
ASP .NEt application I can write xslt for a control matching the control
name!). I found that I can do reasonably well by creating a schema for my
xml, genrating a typed dataset to the schema, filling the dataset with my
xml data and attaching it to a datagrid with (dynamically) bound controls.

However I should say, in this process, I now have hit upon another issue.

I am trying to get a typed dataset from an xsd. However, the VS 2003
Enterprise Architect IDE says that "The same table (Table name) cannot be
the child table in two nested relations". I googled this and found that the
XML viewer sometimes throws up this message. But, in my case, I get this
message when I am trying to get a typed dataset from my xsd. I do have a
multpile reference to a child element, but I do not see how it violates any
of the W3C norms. Could you please help me out?

TIA
Krishnan

[quoted text, click to view]

Pascal Schmitt
10/8/2005 12:00:00 AM
Hello!

[quoted text, click to view]

I didn't look very closely at the sample but it looks like you should be
able to produce the XML wich is generated by the designer using XSLT
from your data and deserialize it dynamically to an UI...
(You could also directly create C#-Code from XSLT and compile it
dynamically)
Or you look at GTK#, wich afaik supports an XML-syntax for building
forms. #develop also has something with XML-forms, maybe Qt#... (it
would be easier than Windows.Forms because of automatic layout managers)


[quoted text, click to view]

How does the XSD look like?
IIRC the message occurs for something matching this:
<root>
<a>
<a>foo</a>
</a>
</root>


--
v-kevy NO[at]SPAM online.microsoft.com
10/10/2005 7:46:01 AM
Hi,

The XSD has to obey not only the W3C norms, but also the DataSet schema
norm. This issue occurs because of the xsd is invalid. You can also check
the following KB article for more information.

http://support.microsoft.com/default.aspx?scid=kb;en-us;325696

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
Krishnan
10/12/2005 11:46:29 AM
Thanks Kevin

[quoted text, click to view]

AddThis Social Bookmark Button