Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Silverlight 从JavaScript获取XAMLUI元素_Silverlight - Fatal编程技术网

Silverlight 从JavaScript获取XAMLUI元素

Silverlight 从JavaScript获取XAMLUI元素,silverlight,Silverlight,我试着在谷歌上搜索,但也许我没有形成正确的查询,因为我得到了很多废话和无关的东西。这个问题可能太简单了。抱歉,我已经有一段时间没做Silverlight了 如果我有一个XAML元素: <Image Canvas.Top="128" x:Name="img4_7" Width="180.3" Height="117" Source="monkey1.jpg" Stretch="Fill" Canvas.Left="-3.344" Opacity="0.595"/> 显然,这是行不通的

我试着在谷歌上搜索,但也许我没有形成正确的查询,因为我得到了很多废话和无关的东西。这个问题可能太简单了。抱歉,我已经有一段时间没做Silverlight了

如果我有一个XAML元素:

<Image Canvas.Top="128" x:Name="img4_7" Width="180.3" Height="117" Source="monkey1.jpg" Stretch="Fill" Canvas.Left="-3.344" Opacity="0.595"/>
显然,这是行不通的

我没有使用ASP.NET AJAX

谢谢你对这个问题的帮助

找到了答案

需要使用control.content.findName()

这是我的工作量,让其他人受益:

handleLoad: function(control, userContext, rootElement) 
{
    this.control = control;

    // Sample event hookup: 
    rootElement.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.handleMouseDown));

    this.img4_7=control.content.findName("img4_7"); 

    if (this.img4_7) {
        this.img4_7.addEventListener("MouseEnter", Silverlight.createDelegate(this,this.handleMouseEnter));
        this.img4_7.addEventListener("MouseLeave",Silverlight.createDelegate(this,this.handleMouseLeave));

    }


},

请原谅我打断了这个老问题。但我和你的情况完全一样,但这不起作用。。。我需要这个元素:其中x:Name是唯一的名称(每个start\u data\u字母都有一个名称)哇,这是一个老名字!这个问题是针对Silverlight 1的,所以我不确定它是否与2+相关,因为它们有不同的体系结构(它们有“迷你CLR”)。也许你在不知不觉中使用了3/4?我相信您可以编写一个类似Silverlight 1的加载程序,如果这就是您的目标?否则,您需要在Silverlight应用程序本身中执行您需要的操作,或者利用另一个JSAPI来访问XAML DOM(我目前还不知道)。对不起,我帮不上忙了。是的,我正在使用Silverlight 1。但是不用担心,现在已经修好了。
handleLoad: function(control, userContext, rootElement) 
{
    this.control = control;

    // Sample event hookup: 
    rootElement.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.handleMouseDown));

    this.img4_7=control.content.findName("img4_7"); 

    if (this.img4_7) {
        this.img4_7.addEventListener("MouseEnter", Silverlight.createDelegate(this,this.handleMouseEnter));
        this.img4_7.addEventListener("MouseLeave",Silverlight.createDelegate(this,this.handleMouseLeave));

    }


},