Reputation: 3759
So I've been making a Windows Store app. For now, it simply has a bunch of Buttons in a Grid. I want to make it so these Buttons (along with their font size) will scale up/down to accommodate its entire parent. I've tried messing around with http://code.msdn.microsoft.com/windowsapps/Scaling-sample-cf072f4f and while it helped me do some scaling, it didn't help me do what I wanted to. I came from an Android background and am used to easily being able to do this. Can I easily accomplish this on C#/XAML applications?
Upvotes: 1
Views: 136
Reputation: 19296
You can use Viewbox class.
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Button Grid.Row="0">
<Button.Content>
<Viewbox>
<TextBlock Text="First button..." />
</Viewbox>
</Button.Content>
</Button>
<Button Grid.Row="1">
<Button.Content>
<Viewbox>
<TextBlock Text="Second button..." />
</Viewbox>
</Button.Content>
</Button>
<Button Grid.Row="2">
<Button.Content>
<Viewbox>
<TextBlock Text="Third button..." />
</Viewbox>
</Button.Content>
</Button>
</Grid>
Upvotes: 1