【发布时间】:2016-07-25 12:29:57
【问题描述】:
我有以下代码:
<StackPanel Orientation="Vertical">
<Viewbox Height="100" >
<Canvas x:Name="pluginTile" Style="{StaticResource productImageTopFade}" Width="320" Height="200">
<Image Panel.ZIndex="1" Source="{Binding PluginImagePath}" Margin="0,10,15,0" ></Image>
<Canvas.Effect>
<DropShadowEffect ShadowDepth="2" Opacity="0.15" Direction="270" BlurRadius="20" />
</Canvas.Effect>
</Canvas>
</Viewbox>
<Border BorderBrush="Transparent" BorderThickness="1">
<Label FontWeight="Normal" Name="ProductName" Content="{Binding NameAndEdition}" Margin="0 0 0 0" VerticalAlignment="Bottom" HorizontalAlignment="Center" Foreground="Gray" />
</Border></StackPanel>
我想要在视图框中显示不同尺寸的图像,上面提到的代码是 ListBox 的 ItemContainerStyle 的一部分。 问题是我在列表框中得到了不同尺寸的图像,其中一些被剪切,而一些尺寸缩小,有什么方法可以显示这些尺寸相同的图像?
【问题讨论】:
-
ViewBox.Stretch?您必须 read 了解
ViewBox的工作原理。
标签: c# wpf xaml listbox wpf-controls