How do you get the client size in a Silverlight Application?

Posted by Stefan on Stack Overflow See other posts from Stack Overflow or by Stefan
Published on 2009-07-15T17:42:53Z Indexed on 2010/05/14 16:14 UTC
Read the original article Hit count: 186

Filed under:

I want to get the size of the browser window running my Silverlight Application? I've tried the following lines, but it always returns zero!

public Page()
    {
        InitializeComponent();
        Initialize();

    }

    public void Initialize()
    {

        WorldLimits.Y = Application.Current.Host.Content.ActualHeight;
        WorldLimits.X = Application.Current.Host.Content.ActualWidth;

        gameCore = new GameCore(this);
        gameTime = DateTime.Now.TimeOfDay.TotalMilliseconds / 1000;

    }

© Stack Overflow or respective owner

Related posts about Silverlight