[SOLVED] Error in Window.OnMouseOver

Please post public support tickets here. Note: for private support tickets, please send an email to support@cshtml5.com instead.
kmatt
Posts: 30
Joined: Wed Feb 01, 2017 11:16 am

[SOLVED] Error in Window.OnMouseOver

Postby kmatt » Mon Aug 07, 2017 6:36 am

In the simulator, when I move the mouse across elements created in an htmlpresenter, I get errors that come from the cshtml5 libraries.
This is the xaml:

<native:HtmlPresenter Name="mapToolbar" VerticalAlignment="Top" Visibility="Visible" HorizontalAlignment="Stretch"/>

And this is the code behind (it occurs well after the UserControl is loaded):
mapToolbar = mapScreen.GetMapToolbar();
mapToolbar.Html = "<nav id=\"toolbar\" display=\"inline\">" +
"<label for=\"ShowFootPrintsButton\" style=\"font-size:14px;font-weight:bold;\">Show Footprints</label>" +
"<input id=\"ShowFootPrintsButton\" name=\"ShowFootPrintsButton\" type=\"checkbox\"/ onclick=\"btnShowFootPrints_Click\">" +
"</nav>";

// Set up menu callback from javascript
var _referenceToTheJavaScriptToolbarObject = mapToolbar.DomElement;
Interop.ExecuteJavaScriptAsync(
@"$0.btnShowFootPrints_Click = $1;",
_referenceToTheJavaScriptToolbarObject,
(Action<object>)OnToolbarShowFootPrintsCallback);
implemented as:
private void OnToolbarShowFootPrintsCallback(object obj)
{
throw new NotImplementedException();
}

Error in Window.OnMouseOver(...): The "INTERNAL_idsToUIElements" dictionary does not contain the following key:ShowFootPrintsButton

I must be creating the elements incorrectly but there are no errors displayed on creation. Clicking on the item gives the same error. If I add a () after $1 I do not get the error and the C# method is called - as the items is created, not when it is clicked.

kmatt
Posts: 30
Joined: Wed Feb 01, 2017 11:16 am

Re: Error in Window.OnMouseOver

Postby kmatt » Tue Aug 08, 2017 9:10 am

Fixed it. In xaml the set for the onclick in javascript needed a "()". Also had to name the onclick javascript event method different than the id for the item. The event also need to belong to window instead of to the javascript menu object.


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 3 guests

 

 

cron