我需要制作可沿着垂直轴进行滚动的图像列表。如何制作可滚动的垂直网格图像
图片链接在string[] imagesLocation
。
当点击图块时,事件处理程序应该知道string imageLocation
。
它建议立即进行删除是这个样子:
我能够使其在网格中。但无法使其滚动。
发现一些小费使用LongListSelector
,但无法使其工作。
更新:
MainPage.xaml.cs中:
namespace PhoneApp1
{
public partial class MainPage : PhoneApplicationPage
{
public MainPage()
{
InitializeComponent();
ContentPanel.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
ContentPanel.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength() });
ContentPanel.RowDefinitions.Add(new RowDefinition() { Height = new GridLength() });
ContentPanel.Children.Add(new TextBlock() { });
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 5; j++)
{
Image MyImage1 = new Image();
MyImage1.SetValue(Grid.ColumnProperty, i);
MyImage1.SetValue(Grid.RowProperty, j);
ImageSource src = new BitmapImage(new Uri(string.Format("Assets/ApplicationIcon.png"), UriKind.RelativeOrAbsolute));
MyImage1.Source = src;
ContentPanel.Children.Add(MyImage1);
}
}
}
}
}
MailPage.xaml:
<phone:PhoneApplicationPage
x:Class="PhoneApp1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="True">
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
<TextBlock Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<Grid Grid.Row="1" x:Name="ContentPanel">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="160"></ColumnDefinition>
<ColumnDefinition Width="160"></ColumnDefinition>
<ColumnDefinition Width="160"></ColumnDefinition>
</Grid.ColumnDefinitions>
</Grid>
</Grid>
</phone:PhoneApplicationPage>
您是否尝试过gridview的? – Archana