I am wanting to display a the value of a data attribute of a path tag into a div tag in html. I cannot seem to get it to work. This is what I have:
XAML
<Canvas xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Canvas Width="300" Height="300" MouseLeftButtonDown="splitData">
<Rectangle x:Name="button" Width="50" Height="25" Canvas.Top="100" Stroke="Black" Fill="White" />
<Path x:Name="Text" Stroke="Black" Fill="Black" Data="Data Here" />
</Canvas>
</Canvas>
Javascript
function splitData(sender, mouseEventArgs){
var myText = sender.findName("Text").Data;
document.getElementById("pathText").innerHTML=myText;
}
I have tried toString() also and it doesn't work. When I click somewhere on the canvas, it only displays "PathGeometry". It won't display my data.
Any help would be appreciated. Thank.