WPF Form based on XSD - wpf

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

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.

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

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.

Related

How do I make LiveCycle understand HTML tags embedded in XML

I am using XML schema to bind data to LiveCycle PDF form.
How do I make LiveCycle understand HTML tags embedded in XML.
Your question is a bit vague. Typically, we dont use HTML tags contained in XML as they are typically contained in a CDATA tag. Can you please elaborate more and possibly paste sample XML data as well.
Thanks,
Armaghan.

How Can I Read An HTML Document And Extract Image Names?

I'm developing an application in WPF, C# and VS2010 and am not sure how to proceed with this...
I am interested in an algorithm to obtain all the .jpg and .bmp images that are referenced within an html file. How can I extract the body from within an html file?
Thanks
The HTML Agility Pack is a pretty solid library for extracting elements from an HTML document. A simple view is to see it as a wrapper over XPATH with a nice API.
You can do it with regular expressions.
http://msdn.microsoft.com/en-us/library/ms228595.aspx
The following pattern should work:
(http?:\/\/.*\.(?:png|jpg|gif))

Extract string from labels in xaml to resource files

I can't find any method of extracting string values from xaml (Silverlight) to a resource file. Do I really have to do this manually?
If this is not supported in VS2010, are there any 3rd party tools which offers help on this issue?
Building and maintaining resource files for localization purposes is quite tedious if you have to do this manually.
This should do the trick: http://wpflocalizeaddin.codeplex.com/
XAML is just XML, so you can write an XML parser in a Winforms app to find all the strings.
We did away with the need for the resources using a different technique (based on attached properties):
Link: Localisation of Silverlight projects after completion

Including WPF's namespace in an XSD

We have a custom XML schema that can contain chunks of XAML for defining WPF DataTemplates. I used Visual Studio 2010's "Create Schema" command to generate an XSD based on a sample document that uses our schema.
One of the first lines in the generated schema was this:
<xs:import namespace="http://schemas.microsoft.com/winfx/2006/xaml/presentation"/>
However, Visual Studio generates this warning for the line:
"Imported schema for namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation' was not resolved"
Does it need an XSD for Microsoft's presentation schema to work? If so, is there anywhere I can download WPF's XSD (I haven't found one with Google, yet). Is there another way around this?
If you use xs:import, and want to use that schema for validation, you will have to provide that (XAML) schema. This can be done in different ways: place file in a known folder, use URL, or load schemas one by one into .NET schema set.
Another option is to use xs:any to declare your chunks of XAML, then you will have option to validate it against XAML schema or not.

Display formatted text in a window using python

I make a program in wxpython which displays questions to the user and a radiobox with answers. Questions and answers should be in a database and is formatted text using some mathematics (paranthesis, root squares etc). Could you propose me what widget I should use for such a text and what could be the database?
Thanks.
For database you can use any sql based DB e.g. mysql or sqllite but if you do not have much data why not just store it in text files or as python module itself.
Displaying math symbols part is tricky, you will need a control which can display MathML(http://en.wikipedia.org/wiki/MathML) , I don't think any wxPython widget can do that, some browsers display MathML, so you may embed browser inside wxpython but that is also tricky.
Another alternative is to use mathplotlib to draw math symbols e.g. see http://matplotlib.sourceforge.net/users/mathtext.html#mathtext-tutorial
but IMO simplest/best way would be to just convert mathml xml to a image file and display it in a image control inside your app.
e.g. you can use http://sourceforge.net/projects/svgmath/ to convert mathml to svg, convert svg to png using http://librsvg.sourceforge.net/
or you can also try http://sourceforge.net/projects/jeuclid/
You will have to experiment to see what is easiest for you but i don't think there is any easy way.

Resources