Skip to main content

Microsoft Silverlight

Answered Question Resizing Silverlight screen according to screen resolutionRSS Feed

(0)

Cute_Raj
Cute_Raj

Member

Member

31 points

58 Posts

Resizing Silverlight screen according to screen resolution

Hi,

 I am creating a web application where I am using silverlight as full screen mode. So I want to resize all the controls inside the page according to the screen resolution. Say if I see this page in mobile device then according to the screen resolution page size should be shrinked

Right now I am using scrollviewer for all the page. I don't know how to create a page like this.

 Please help me

Krasshirsch
Krasshirsch

Participant

Participant

1032 points

300 Posts

Answered Question

Re: Resizing Silverlight screen according to screen resolution

You should download the Silverlight Control Kit from CodePlex.

There you will find a Viewbox. Put your LayoutRoot inside a Viewbox, if you change the size of the Viewbox, the content will scale accordingly.

A Bro must always post bail for another Bro, unless it's out of state or, like, crazy expensive.

Crazy Expensive Bail > (Years You've been Bros) * $100

Alexander Wieser
Germany

Cute_Raj
Cute_Raj

Member

Member

31 points

58 Posts

Re: Resizing Silverlight screen according to screen resolution

Hi,

Thanks for your valuable answer. But I am facing one more problem, I want to show my silverlight application in  a full screen mode. But while testing seeing this page there are few spaces between the application and it is not occupying the whole screen.

I tried using  

void Content_Resized(object sender, EventArgs e)
{
  Application.Current.Host.Content.IsFullScreen = true;
}        
void ViewBoxPage_LayoutUpdated(object sender, EventArgs e)
{
   Application.Current.Host.Content.IsFullScreen = true;
}
but no use.I am developing this application on Laptop and  the screen resolution is 1280X800. 
So what should I need to do?

ssenthil
ssenthil

Member

Member

487 points

106 Posts

Answered Question

Re: Resizing Silverlight screen according to screen resolution

Hi

you can try like this

Add below event in your page constructor

App.Current.Host.Content.Resized += new EventHandler(this.Content_Resized);

and add definition

private void Content_Resized(object sender, EventArgs e)

{

layoutroot.Width = App.Current.Host.Content.ActualWidth;  //layoutroot is ur root layout

layoutroot.Height = App.Current.Host.Content.ActualHeight;

}

So that while resizing browser your controls will not go off, control size will reduce automattically 

Cute_Raj
Cute_Raj

Member

Member

31 points

58 Posts

Re: Resizing Silverlight screen according to screen resolution

Thanks Senthil. It really works. Thanks a lot!

ssenthil
ssenthil

Member

Member

487 points

106 Posts

Re: Resizing Silverlight screen according to screen resolution

Thanks Raj....

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities