JS中如何获取XAML的某个节点代码?
<?xml version= "1.0 " encoding= "utf-8 "?>
<Canvas xmlns= "http://schemas.microsoft.com/winfx/2006/xaml/presentation " xmlns:x= "http://schemas.microsoft.com/winfx/2006/xaml " x:Name= "icons " Width= "800 " Height= "600 " Clip= "F1 M 0,0L 800,0L 800,600L 0,600L 0,0 " >
<Rectangle Name= "a " Stroke= "#FFB0CB65 " StrokeLineJoin= "Round " StrokeThickness= "2 " Width= "80 " Height= "68 " Canvas.Left= "57 " Canvas.Top= "46 " Fill= "#FFF25353 "/>
</Canvas>
如何使用JS获取以上XAML中的 <Rectangle Name= "a " Stroke= "#FFB0CB65 " StrokeLineJoin= "Round " StrokeThickness= "2 " Width= "80 " Height= "68 " Canvas.Left= "57 " Canvas.Top= "46 " Fill= "#FFF25353 "/> 代码。
就像DHTML中的OUTERHTTML方法一样。
[解决办法]
XAML是基于XML的,因此可以用DOM去读
[解决办法]
但是不用MOUSEDOWN事件实现起来难度太大了吧。。。
[解决办法]
可否講講為什麼不想在Rectangle中寫MouseDown事件啊?
[解决办法]
分开控制,代码耦合性太大,维护成本增高。
我感觉你还是把需求陈述一下。