I am writing an application under windows phone, the goal is to output the data to the ListBox, I do this:
myVM = new ObservableCollection<ParaModel>(); myVM.Add(currentWeek.Days[dayOfWeek].Pars[0]); myVM.Add(currentWeek.Days[dayOfWeek].Pars[1]); myVM.Add(currentWeek.Days[dayOfWeek].Pars[2]); listData.ItemsSource = myVM; in the myVM collection with data everything is OK, the final object has 2 lines, but listData.ItemsSource = myVM does not fail
in xaml it looks like this:
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <ListBox x:Name="listData" Margin="10,0,0,334"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Width="300" FontSize="40" Text="{Binding Caption}" /> <TextBlock Width="100" FontSize="40" Text="{Binding Audit}" TextAlignment="Right" /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </Grid> explain, pliz, what I'm doing wrong ..
ItemTemplateand see what happens. - VladD