I'm new to WPF. I have a WPF Window with a bunch of Labels on it as well as a ListBox.
When resizing the window, I want to scale the size of SOME of the Labels, but not all of them. I don't want the ListBox to scale either--just some Labels.
I understand I can use a Viewbox to resize as the Window resizes, but as much as I mess with it, I'm not getting the desired effect. Of course I can't surround the entire thing with a Viewbox because that would resize everything, so I figured I would have to drop a bunch of different Viewboxes throughout the Window surrounding each label I want to expand. But of course... nothing expands at all when I do this.
Along the same lines, when I expand the labels, there are other labels that need to remain right next to those labels because they are identifiers.
So... here's the XAML I have at this point. I don't even know if I'm on the right path. Any help making the labels with number in them expand with the window would be appreciated.
<Window x:Class="WpfApplication7.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApplication7"
Title="Window1">
<StackPanel Orientation="Horizontal">
<ListBox Margin="2">
<ListBoxItem>a</ListBoxItem>
<ListBoxItem>b</ListBoxItem>
<ListBoxItem>c</ListBoxItem>
</ListBox>
<StackPanel Orientation="Vertical">
<Label>Title</Label>
<StackPanel Orientation="Horizontal">
<Grid>
<Grid.RowDefinitions><RowDefinition/><RowDefinition/><RowDefinition/><RowDefinition/></Grid.RowDefinitions>
<Label Grid.Row="0">A</Label>
<Label Grid.Row="1">B</Label>
<Label Grid.Row="2">C</Label>
<Label Grid.Row="3">D</Label>
</Grid>
<Grid>
<Grid.RowDefinitions><RowDefinition/><RowDefinition/><RowDefinition/><RowDefinition/></Grid.RowDefinitions>
<Viewbox Grid.Row="0" Stretch="Fill">
<Label>1</Label>
</Viewbox>
<Viewbox Grid.Row="1" Stretch="Fill">
<Label>2</Label>
</Viewbox>
<Viewbox Grid.Row="2" Stretch="Fill">
<Label>3</Label>
</Viewbox>
<Viewbox Grid.Row="3" Stretch="Fill">
<Label>4</Label>
</Viewbox>
</Grid>
<Grid>
<Grid.RowDefinitions><RowDefinition/><RowDefinition/><RowDefinition/><RowDefinition/></Grid.RowDefinitions>
<Viewbox Grid.Row="0" Stretch="Fill">
<Label>5</Label>
</Viewbox>
<Viewbox Grid.Row="1" Stretch="Fill">
<Label>6</Label>
</Viewbox>
<Viewbox Grid.Row="2" Stretch="Fill">
<Label>7</Label>
</Viewbox>
<Viewbox Grid.Row="3" Stretch="Fill">
<Label>8</Label>
</Viewbox>
</Grid>
<Grid>
<Grid.RowDefinitions><RowDefinition/><RowDefinition/><RowDefinition/><RowDefinition/></Grid.RowDefinitions>
<Label Grid.Row="0">E</Label>
<Label Grid.Row="1">F</Label>
<Label Grid.Row="2">G</Label>
<Label Grid.Row="3">H</Label>
</Grid>
</StackPanel>
</StackPanel>
</StackPanel>
</Window>