XAML:

                    <ListBox x:Name="ItemBox" Grid.Column="0" Tap="ItemBox_Tap">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Grid Width="300" Height="150" Margin="12,0,0,20">
                                    <Border Background="#01BCF3">
                                        <Image Source="" Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}" />
                                    </Border>
                                    <StackPanel VerticalAlignment="Top" Margin="10,0" >
                                        <TextBlock Text="{Binding Title}" TextWrapping="Wrap" Margin="10,0" FontSize="24"  Style="{StaticResource PhoneTextTitle3Style}" />
                                        <!--<TextBlock Text="{Binding PublishDate}" Margin="10,0" FontSize="18" Foreground="#FF8F8F8F"/>-->
                                    </StackPanel>
                                </Grid>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>

后台代码:

        private void ItemBox_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            var item = ItemBox.SelectedItem as CourseItem;
            CommonConfig.SelectedItem = item;
            //this is the fake course page in App
            this.NavigationService.Navigate(new Uri("/CoursePage.xaml", UriKind.Relative));
        }

其中ItemBox的数据源是List<CourseItem>.

相关文章:

  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
  • 2022-03-10
  • 2021-10-08
  • 2022-01-11
  • 2022-12-23
  • 2021-08-08
猜你喜欢
  • 2022-12-23
  • 2022-02-02
  • 2021-05-19
  • 2022-12-23
相关资源
相似解决方案