<ListView x:Name="Stickers1" Visibility="Collapsed"
SelectionChanged="Stickers1_SelectionChanged"
ScrollViewer.VerticalScrollMode="Enabled"
ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="50"
FontSize="36" Margin="0" ItemTemplate="{StaticResource
listStickersDataTemplate}">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<WrapGrid Orientation="Horizontal"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
<DataTemplate x:Key="listStickersDataTemplate">
<Grid>
<Image Source="{Binding Imageurl}" Stretch="Fill" Height="200" Width="200"/>
</Grid>
</DataTemplate>`
答案 0 :(得分:0)
查看您的Stickers1_SelectionChanged
事件,您似乎无法在Source
img
Canvas
下面的内容应该修复它
private void Stickers1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var selecteditem = e.AddedItems[0] as StickersImageListModel;
Stickers1.Visibility = Visibility.Collapsed;
BitmapImage image = new BitmapImage(new System.Uri("ms-appx://" + selecteditem.ImageUrl, UriKind.Absolute));
img.Source = image;
my_canvas.Visibility = Visibility.Visible;
}