Code: Select all
CSharpXamlForHtml5.DomManagement.SetHtmlRepresentation(this, @"<input type=""number"">");
Code: Select all
using System;
using Windows.UI.Xaml.Controls;
namespace MyApplication
{
public class InputNumberUserControl : UserControl
{
double _value;
public InputNumberUserControl()
{
CSharpXamlForHtml5.DomManagement.SetHtmlRepresentation(this, @"<input type=""number"">");
}
public double Value
{
get
{
if (CSharpXamlForHtml5.DomManagement.IsControlInVisualTree(this))
{
object htmlInputElement = CSHTML5.Interop.GetDiv(this);
string valueAsString = Convert.ToString(CSHTML5.Interop.ExecuteJavaScript("$0.value", htmlInputElement));
double.TryParse(valueAsString, out _value);
}
return _value;
}
}
}
}
Code: Select all
CSHTML5.Interop.ExecuteJavaScript("$0.value = $1", htmlInputElement, value);
Code: Select all
Interop.ExecuteJavaScript(@"
// This is the JavaScript code:
...
var onClick = $1;
...
// Here we register the callback:
map.on('click', onClick);
...
", ..., (Action<object>)OnClick, ..., ...);
void OnClick(object args)
{
// This is the C# callback
....
}
Users browsing this forum: No registered users and 42 guests