1
我是新来的WPF。我有一个WPF窗口,上面有一堆标签以及一个ListBox。WPF/XAML - 将文本大小缩放到窗口大小
调整窗口大小时,我想缩放某些标签的大小,但不是全部。我不希望ListBox缩放 - 只是一些标签。
我知道我可以使用一个Viewbox来调整窗口的大小调整大小,但尽管如此,我没有得到预期的效果。当然,我无法用Viewbox来包围整个事物,因为这会调整一切,所以我想我必须在围绕每个我想要展开的标签的窗口中放置一堆不同的Viewbox。但是,当然,当我这样做时,什么都没有扩大。
沿着相同的路线,当我扩展标签时,还有其他标签需要保留在这些标签旁边,因为它们是标识符。
所以...这里是我在这一点上的XAML。我甚至不知道我是否在正确的道路上。任何帮助使与他们的数字标签扩大与窗口,将不胜感激。
<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>
做我修复为你工作?你还没有选择答案。 – Charlie 2009-07-17 23:17:02