Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 576215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:01:25+00:00 2026-05-13T14:01:25+00:00

I’m trying to access properties on the RootVisual object: [ScriptableType] public class ApplicationInfo {

  • 0

I’m trying to access properties on the RootVisual object:

[ScriptableType]
public class ApplicationInfo
{
    public string Name { get; set; }
    public string Version { get; set; }
}

[ScriptableType]
public partial class MainPage : UserControl
{
    [ScriptableMember]
    public ApplicationInfo ApplicationInfo { get; set; }


    public MainPage()
    {
        InitializeComponent();

        this.ApplicationInfo = new ApplicationInfo();
        this.ApplicationInfo.Name = "My Application";
        this.ApplicationInfo.Version = "0.1";
        HtmlPage.RegisterScriptableObject("myapp", this);
    }
}

In my ASPX hosting page I’ve the following JavaScript snippet:

<script type="text/javascript">
    function onPluginLoaded(plugin) {
        alert('in plugin');
        alert(plugin.Name);  //This gives me the x:Name of the RootVisual object
        var appInfo = plugin.ApplicationInfo;
        alert(appInfo);
        alert(plugin.myapp);
        document.title = appInfo.Name + " " + appInfo.Version;
    }
</script>



<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%" OnPluginLoaded="onPluginLoaded" >
<param name="source" value="ClientBin/SLVersion.xap"/>
<param name="onload" value="onPluginLoaded" />

This doesn’t work. I’d like to know why! Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:01:25+00:00Added an answer on May 13, 2026 at 2:01 pm

    There are two things wrong.

    Silverlight Documentation

    The Silverlight documentation about this area of functionality is really quite confused. Here is thing, the object provided as the sender parameter in the onLoad method isn’t what the documentation says that it is, it’s not the silverlight plugin.

    At least its not the plugin as seen by the HTML DOM / Javascript. It seems to be some form of the Javascript API version of a Framework element. In order to get the plugin object that is useful to us we need to call the getHost method on it.

    function onPluginLoaded(sender) {
       var plugin = sender.getHost();
    }
    

    That gets us one step closer.

    Accessing Registered Scriptable Objects

    Scriptable objects that have been registered on HTMLPage are accessed as properties of the Plugin’s Content property. Hence to access the ApplicationInfo object you would need:-

    function onPluginLoaded(sender) {
       var plugin = sender.getHost();
       var appInfo = plugin.Content.myapp.ApplicationInfo;
       alert(appInfo.Name + " " + appInfo.Version);
    }
    

    That’ll get you going.


    ScriptableType

    Remove [ScriptableType] from MainPage, in this case you only want to mark specific members as available to script hence you use the [ScriptableMember]. By using [ScriptableType] you expose all public members automatically as scriptable. You are correctly doing that on your ApplicationInfo.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 443k
  • Answers 443k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You need to use the function pointer type as the… May 15, 2026 at 6:14 pm
  • Editorial Team
    Editorial Team added an answer Try adding validationEvent:false (docs). May 15, 2026 at 6:14 pm
  • Editorial Team
    Editorial Team added an answer Most of the other answers refer to using various hashing… May 15, 2026 at 6:14 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.