C# 肖像图像在WP8中被裁剪
我正在尝试将横向和纵向图像绑定到网格控件。横向图像加载正确,但在加载纵向图像时,我遇到了问题。它们的底部被切断(溢出),因此网格行无法加载具有全高的图像。我尝试使用C# 肖像图像在WP8中被裁剪,c#,windows-phone-7,gridview,windows-phone-8,windows-phone,C#,Windows Phone 7,Gridview,Windows Phone 8,Windows Phone,我正在尝试将横向和纵向图像绑定到网格控件。横向图像加载正确,但在加载纵向图像时,我遇到了问题。它们的底部被切断(溢出),因此网格行无法加载具有全高的图像。我尝试使用Height=“Auto”或Height=“*”设置Row属性,但没有成功。这是我的XAML: <ItemsControl ItemsSource="{Binding ItemsPrasanja}"> <ItemsControl.ItemTemplate> <DataTemplat
Height=“Auto”
或Height=“*”
设置Row属性,但没有成功。这是我的XAML:
<ItemsControl ItemsSource="{Binding ItemsPrasanja}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock
Name="txtPrasanje"
Grid.Row="0"
Text="{Binding Tekst}"
TextWrapping="Wrap" />
<Image Name="imgPrasanje"
Grid.Row="1"
Source="{Binding Slika}"
Margin="0,5,0,0" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
我已经尝试了所有的
拉伸
属性,但没有任何效果。图像仍处于缩影状态。也许您会显示此控件的完整代码和xaml?如果是ListBox,请尝试添加以下内容:
<phone:PhoneApplicationPage.Resources>
<Style x:Key="ListBoxItemStyle" TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</phone:PhoneApplicationPage.Resources>
ItemContainerStyle="{StaticResource ListBoxItemStyle}" to your control
ItemContainerStyle=“{StaticResource ListBoxItemStyle}”到您的控件
ажжжжаааааааа
<phone:PhoneApplicationPage.Resources>
<Style x:Key="ListBoxItemStyle" TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</phone:PhoneApplicationPage.Resources>
ItemContainerStyle="{StaticResource ListBoxItemStyle}" to your control