开发者

How to find the nth child element of a Silverlight Grid, using Javascript?

I have been looking around for this on Google but I have not yet found a good result.

I would like to simply select the nth child element of a Silverlight Grid, using Javascript, like this:

for (var i = 0; i < grid.children.count; i++) {
    if (grid.getChild[i]['Grid.Row'] == rowIndex
        && grid.getChild[i]['Grid.Column'] == columnIndex) {
            //DoSomething();
            break;
    }
}

I have tried guessing: grid.getChild(), grid.getChild(n), grid.child[n], grid.children[n].. none of those appear to exist.

So, simply, what method do I have to use to get the nth child element?

p.s.: I have been trying to search for the开发者_高级运维 Silverlight API online (pretty much like Java has the javadoc reference with over 14.000 pages of each class and its method..), but no success. If anyone knows where it is, I'd be glad to know.

Thanks


The visual element tree in Silverlight is not exposed to JavaScript. It is internal for good reason. That would expose Silverlight to JavaScript-based hacking.

You can however expose methods in your Silverlight application to Javascript, so I would suggest creating a C# method in your Silverlight app to return, or alter, specific elements in the Visual Tree and call that from Javascript instead.

You mark classes you wish to expose to Javascript with the [ScriptableType] attribute and methods you wish to call with the [ScriptableMember] attribute.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜