Skip to main content

Microsoft Silverlight

Answered Question How to set 100% width / height?RSS Feed

(0)

Skute
Skute

Member

Member

222 points

156 Posts

How to set 100% width / height?

Hi, in Flex you can set the width / height of a component to be 100%, e.g.

<TextBox width="100%" height="100%">

How can I do this in Silverlight?

Also, Flex has a spacer component that you can add into auto arranging components. E.g. I would like a stack panel like the following:

 <StackPanel>

<Label width="Auto"/>

<Button width="73"/>

<Spacer width="100%"/>

<Button width="73"/>

</StackPanel>

 

The result of this is a label on the left, with a button next to it, and then the remaining button on the right hand side.

Any help appreciated,

Thanks
 

SteveWong
SteveWong

Contributor

Contributor

6343 points

1,281 Posts

Answered Question

Re: How to set 100% width / height?

If you add that into the Grid which is as the size of the Page

UIElement will be automatic set the be 100%

Regards,
SteveWong (HongKong)
Please mark post as answer if they help you

Client App Dev

Skute
Skute

Member

Member

222 points

156 Posts

Re: Re: How to set 100% width / height?

So a UIElement will automatically fill the entire space of a Grid control? Is that specific to grid controls, or will that happen with all controls?

Thanks, 

Allen Chen – MSFT
Allen Ch...

Star

Star

13862 points

1,803 Posts

Answered Question

Re: Re: How to set 100% width / height?

Hi:

  It's specific to Grid control.

Regards

Sincerely,
Allen Chen
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities