Hello. I make a schedule, and there is a problem: How to add a PivotItem to an existing Pivot, for some the title will be set programmatically, the content of which PivotItem is ListView, and the Listview is binding data. That is, the output should be PivotItem, the name of which corresponds to the days of the week, and in each of them there is a ListView with information about the schedule.

ListView:

<ListView x:Key="SubjectsTable"> <ListView.ItemTemplate> <DataTemplate> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="50"/> <ColumnDefinition Width="50"/> <ColumnDefinition Width="100"/> <ColumnDefinition Width="100"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <TextBlock Text="{Binding Weeks}" Grid.Column="0" TextWrapping="WrapWholeWords"/> <TextBlock Text="{Binding LessonTime}" Grid.Column="1" TextWrapping="WrapWholeWords"/> <StackPanel Orientation="Vertical" Grid.Column="2"> <TextBlock Text="{Binding Subject}" TextWrapping="WrapWholeWords" TextAlignment="Center"/> <TextBlock Text="{Binding LessonType}" TextAlignment="Center"/> </StackPanel> <TextBlock Text="{Binding Auditory}" Grid.Column="3" TextWrapping="WrapWholeWords"/> <TextBlock Text="{Binding FirstLastName}" Grid.Column="4" TextWrapping="WrapWholeWords"/> </Grid> </DataTemplate> </ListView.ItemTemplate> </ListView> 

    1 answer 1

    Pivot , like any list, has an ItemsSource property, in which you can feed a collection of days of the week.

    • And you can somehow a little more in detail. Just did not work directly with ItemsSource and did not figure it out. - Morgomirius
    • The ItemsSource property is used to bind a collection as a data source. Those. if you have a collection of rows, then you can attach it to a ListView through ItemsSource , for example. If you use MVVM , it looks like this: <ListView ItemsSource="{Binding MyCollection}"/> Same thing with Pivot - create a collection with DateTime elements and bind. - Make Makeluv
    • Thank you very much, already figured out. The main thing was just not to be afraid to experiment. - Morgomirius