y0j0
y0j0

Reputation: 3592

Stretch control inside ViewBox

I'm using ViewBox control to scale my forms in winstore application. I need stretch controls inside ViewBox but common HorizontalAlignment="Stretch" does not work

This is my code :

    <Viewbox Margin="20" Grid.Row="1" Grid.Column="2" HorizontalAlignment="Stretch">
       <Grid HorizontalAlignment="Stretch" VerticalAlignment="Top" >
...

This is result :

enter image description here

ViewBox is grey rectangle, Grid is selected (blue rectangle), TextBoxes do not have set width.

Can you advise me, how to solve this? I dont want to set width explicitly.

Upvotes: 0

Views: 2189

Answers (1)

kmatyaszek
kmatyaszek

Reputation: 19296

Try set Stretch property to Fill (msdn):

<Viewbox Margin="20" Grid.Row="1" Grid.Column="2" HorizontalAlignment="Stretch" 
           Stretch="Fill">
      <Grid HorizontalAlignment="Stretch" VerticalAlignment="Top">

Upvotes: 1

Related Questions