we translate into html + css!
Welcome to the x2h project!
xaml2html.net (x2h) is a translation service converting xaml into plain html + css.
Forget about css frustrations!
Harness the power of xaml and Visual Studio to create static, fully indexed web content!
Use stackpanels, dockpanels, grids, datagrids, user controls,
data binding, code behind, markup extentions, custom controls, ...
that's what we love in xaml!
You can support this project on Patreon: many thanks!
No good project can start without it. So here it is!
You can use the existing WPF classes to place and initialize items on your
webpage:
Use Grids, DockPanels, StackPanels, Canvas, ... exactly the way you
already do!
Use ItemsControls, ListBoxs or DataGrids, fill them with items, and define
some ItemsTemplates!
Use data binding to fill properties on your page!
Do you like creating UserControls, and using them at multiple places?
Do you like creating your own custom Controls, Panels or
DependencyProperties?
Would you enjoy filling your page with content from a database or a
webservice using C#?
code behind is supported!
Including a powerful text editor...
Using html, it is quite easy to have bold, italic, underline, or links (!) inside a bloc of text. Links are useful, aren't they?
However, doing the same in xaml is not so easy...
That's why x2h includes its own text language!
...supporting resx localization...
...and producing indexed content!
X2h produces plain html + css, no javascript!
Therefore, the text you type in xaml gets simply indexed by the search engines... :)
x2h is pixel exact... on all browsers!
Are you sometimes getting angry with browsers hell?
WHY is that F¨¨¨ element aligned correctly in that browser, and not in the other one?
Forget that with x2h! It is pixel exact!
X2h trusts dotNet, not the browser, for layout calculations... This makes quite a difference! :)
By the way: since x2h uses WPF for layout calculations, all positions get computed before translation...
As a consequence, elements moving in the browser while pictures are loading... belong to history!
Xaml2html is free software.
There are no royalty fees concerning the html + css code generated by x2h.
You own all the rights on the generated html + css, and can use it the way you like: use it, give it, sell it, ... It's all up to you!
This will serve maintenance costs, and future evolutions!
Many thanks!
Integrating x2h in existing content?
By default, x2h generates a full webpage, with html and body tags. That way you can easily test the result in a browser.
However, it is quite easy to integrate x2h content inside an existing page!
Simply set available width and height in xaml in the x2h:Root element.
Copy the first div of the generated html page to your existing page.
Also, it is easy to add some classic html / javascript code inside a x2h-generated page.
Create an empty x2h:Border element in xaml, and set its width and height.
You'll get an empty div in html, with the same width and height, ready to be filled with anything you like!
Are there some limitations?
There is one single rule to obey if you want your xaml code to be correctly translated:
You can use all of dotNet, but only x2h classes may draw something on screen.
So don't use TextBlock, use x2h:TextBlock.
Don't use Border, use x2h:Border.
We also have Button, HyperLinkButton and Image ready to use... :)
Also, x2h is in fact not 100% pixel exact: font rendering -particularly in bold mode- can differ slightly from browser to browser.
However, the difference is tiny enough that it should not cause any trouble. Use a safety margin if you really need to...
Last, remember that x2h translates: it does not run a dotNet virtual machine in the browser.
As a consequence, x2h creates static content, and should not be considered as a replacement for Silverlight...
To work with the above files, you will need to have installed:
Visual Studio 2015 or newer.
The Microsoft dotNet framework version 4.5.2 or newer.