Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

  • lud19

    lud19

    Member

    2 Points

    1 Post

    Re: How to specify the height and width of Canvas by percentage.?

    Jan 08, 2008 06:04 PM | LINK

    When I try to do this I get an null string for the width. From what element did you manage to get the width? Did you modify the default generated test page to test this?

     (From a default application auto-generated code)

    public void Page_Loaded(object o, EventArgs e)
            {
               
                InitializeComponent();

            HtmlDocument _document = HtmlPage.Document;

             _document.GetElementByID("SilverlightControlHost").GetAttribute("id");  --> equal to SilverlightControlHost as expected

            _document.GetElementByID("SilverlightControlHost").GetAttribute("width"); -> Is null

    ... 

    Did a few more, 

    .GetAttribute("style") is set to [object],

    _document.GetElementByID("SilverlightControlHost")..ccsClass is silverLightHost

    But I didn't figure out how to extract the width from the style neither...

    Any hints?

    What I want to do at the end, is to make the page full screen on the browser (using BrowserHost.IsFullScreen = true;) then adjust the size of all the various components according to the available space on the screen...