【发布时间】:2019-02-03 02:27:46
【问题描述】:
我的 ListView 包含 BitmapImages,我想允许放大这些图像。
如果我去 ScrollViewer. ...我没有得到缩放因子。
<UserControl
x:Class="SimplePdfViewer.SimplePdfViewerControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SimplePdfViewer"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Unloaded="root_Unloaded"
x:Name="root">
<UserControl.Resources>
<Style TargetType="ListViewItem" x:Key="ListViewItemEdit">
<!-- spacing between pages-->
<Setter Property="Margin" Value="0 0 0 3"/>
<!-- Setting Background Color of PDf Placeholders to White-->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListViewItem">
<ListViewItemPresenter ContentTransitions="{TemplateBinding ContentTransitions}"
PlaceholderBackground="White"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<ListView x:Name="PdfListView"
ItemsSource="{x:Bind DocumentDataSource}"
ScrollViewer.ZoomMode="Enabled"
ItemContainerStyle="{StaticResource ListViewItemEdit}"
SelectionMode="None">
<ListView.ItemTemplate>
<!-- Implement Dynamic Width! -> Added for Placeholder Width -->
<DataTemplate x:DataType="BitmapImage">
<ListViewItem
Height="1180"
Width="800"
Background="White"
IsHitTestVisible="False">
<Image Source="{x:Bind}"/>
</ListViewItem>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
有没有办法将放大后的图像重置为原始大小?
感谢大家的帮助!
【问题讨论】:
标签: listview scrollview uwp-xaml bitmapimage