Dear rkmore,
Yes, mixing HTML markup with the generated elements is very easy to do.
EDIT (2017): There is now an even simpler way, which is to use the "HtmlPresenter" class, like this:Code: Select all
<HtmlPresenter Html="<canvas id="demo_canvas" Style="width:100%;height:100%" />"/>
Here is some simple code that you can use to insert the HTML-based <input> tag into the XAML visual tree:
- just create a new class that inherits from "Control", and call the "
SetHtmlRepresentation" method in its constructor, as show below:
Code: Select all
namespace Application1
{
public class MyControl : Windows.UI.Xaml.Controls.Control
{
public MyControl()
{
CSharpXamlForHtml5.DomManagement.SetHtmlRepresentation(this, "<input type='file' accept='image/*' capture='camera'>");
}
}
}
- then, use the control is your XAML code, as show in the following example (where you need to replace "Application1" with the namespace of your application):
Code: Select all
<Page
x:Class="Application1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Application1">
<Canvas>
<local:MyControl/>
</Canvas>
</Page>
If you want, you can interact with the HTML <input> element from within C#, by calling the "
CSHTML5.Interop.GetDiv(this)" method AFTER the control has been added to the visual tree (for example in the Loaded event), and then passing the result to the method:
CSHTML5.Interop.ExecuteJavaScript("enter your JS with parameter {0}", TheParameterGoesHere)You can see a complete example by looking at the source code of the
ArcGIS Mapping Extension.
Regards,
JS-Support
PS: I cannot wait to see your finished app!