3

I am new in WPF and want to create a UI using XSD that autogenerates the controls.

See screenshot

enter image description here

Bharat Jangir
  • 450
  • 1
  • 4
  • 14
  • Do you mean XSL (Xml Stylesheets Language)? XSD doesn't make much sense. Also, it would help if you provided an example of what XML you would like to turn into XAML and/or code. – NextInLine Feb 17 '15 at 19:20
  • @NextInLine XSD stands for XML Schema Definition – RedLaser Feb 17 '15 at 22:55
  • @RedLaser I'm not sure how an XSD it applies here. As I understand it, XSDs are for validating XML. As I understand it, OP is requesting to generate XAML code from an XML document, not validate that the XAML is correct (which for WPF is normally what a compiler is for). – NextInLine Feb 17 '15 at 23:36
  • Where is the question ? – Nicolas Repiquet Feb 18 '15 at 10:13

3 Answers3

4

Just write proper XSLT for your XSD.

XSD is valid XML so it can be parsed with XSLT to get any other document. Because XAML is valid XML it won't be so hard.

You can find examples of XLST transforming XML to HTML and start from them. It's easier and gives immediate feedback if your XSLT is good.

Here you can find whole project to convert XSD to HTML form.

EDIT: As it was suggested you can load your XAML in runtime but I think more convenient and handy will be generating it at build step. See this answer and documentation to get more details.

Community
  • 1
  • 1
janisz
  • 6,292
  • 4
  • 37
  • 70
1

Yes, XAML is valid XML and can be transform. But if You want transform and load in runtime You must read answer for this topic

Community
  • 1
  • 1
Andrey Ganin
  • 349
  • 1
  • 10
0

You may use InfoPath to design a Form with Your XSD as starting point and save the design as Extract. You will find a folder with InstanceSample, XSLT and XSD.

willi
  • 1
  • 1