Listview不显示数据,但显示名称空间和数据模型

时间:2015-08-23 21:35:32

标签: c# xaml binding windows-phone-8.1

我正在使用folloowing类,但它不允许我在我的xaml中显示show_times它刚刚出现

popcornpk.datamodel.fetchtiming

 public class FetchTiming
 {
        public string id { get; set; }
        public string theater_name { get; set; }
        public string address { get; set; }
        public List<string> show_times { get; set; }
        public string screen_id { get; set; }
        public string title { get; set; }
}

public class MovieDetail
{
        public MovieDetails movie_details { get; set; }
        public List<FetchTiming> fetch_timing { get; set; }
}

我的班级电话

public async Task<MovieDetail> GetMovieShowtimesAsync()
{
        string jsonresult = await WCFRESTServiceCall("GET", "movie_details");
        var jarray = JsonConvert.DeserializeObject<MovieDetail>(jsonresult);


        return jarray;

}

这是我的xamlmethod调用我想知道正在返回的数据是什么,但我似乎不能显示它

private async void listViewShowtimes_Loaded(object sender, RoutedEventArgs e)
{
        popcornpk_Dal _dal = new popcornpk_Dal();
        MovieDetail _showTimes = await _dal.GetMovieShowtimesAsync();

        var listView = (ListView)sender;

        listView.ItemsSource = _showTimes.fetch_timing.ToList();

}

DataTemplate的Xaml

<PivotItem x:Name="pvtShowTimes" Header="showtimes">
<Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <ListView x:Name="listViewShowtimes" ItemsSource="{Binding}" Loaded="listViewShowtimes_Loaded">
                    <DataTemplate>
                        <StackPanel Height="505">

                            <TextBlock FontSize="13" x:Name="txtshowtime"  Text="{Binding theater_name}" HorizontalAlignment="Left" Margin="19,223,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="212" Foreground="White" Height="29" SelectionChanged="txtTtile_SelectionChanged"/>
                            <TextBlock FontSize="13" x:Name="txtshow_times"  Text="{Binding address}" HorizontalAlignment="Left" Margin="19,223,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="212" Foreground="White" Height="29" SelectionChanged="txtTtile_SelectionChanged"/>

                        </StackPanel>
                    </DataTemplate>
                </ListView>
</Grid>                
</PivotItem>

下面是在设备上运行的应用程序的屏幕截图,任何帮助都会大大降低。 enter image description here

好吧所以我至少在显示时间屏幕上显示了thertre名称,但它仍然不允许我显示show_times字段。

 <ListView x:Name="listViewShowtimes" ItemsSource="{Binding}" Loaded="listViewShowtimes_Loaded">
 <ListView.ItemTemplate>

  <DataTemplate>

                        <Grid Grid.Row="0">
                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition  />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>

                                <TextBlock FontSize="13"   Grid.Row="0" Grid.Column="0"  x:Name="txtshowtime"  Text="{Binding theater_name}" HorizontalAlignment="Left"  TextWrapping="Wrap" VerticalAlignment="Top" Width="212" Foreground="White" Height="29" />
                                <TextBlock FontSize="13" Grid.Row="1" Grid.Column="0" x:Name="txtshow_times"  Text="{Binding show_times}" HorizontalAlignment="Left"  TextWrapping="Wrap" VerticalAlignment="Top" Width="212" Foreground="White" Height="29" />


                        </Grid>
                    </DataTemplate>
                    </ListView.ItemTemplate>
 </ListView>

我认为我需要的是如何通过xaml绑定字符串列表问题我需要显示时间显示在电影院名称下面你看到他们的 enter image description here

0 个答案:

没有答案