Reputation: 147
I have a PivotItem added dynamically and another 2 PivotItems which are added from the designer. I would like to place the one added dynamically first (First from the left).
<Pivot Name="EntryPivot" Title="Gym Crew" Background="Azure">
<Pivot.RightHeader>
<CommandBar>
<AppBarButton Icon="Import" Label="Import" Click="ImportCsv_Button"/>
<AppBarSeparator/>
<AppBarButton Icon="Edit" Label="Edit"/>
<AppBarButton Icon="Delete" Label="Delete"/>
<AppBarSeparator/>
<AppBarButton Icon="Save" Label="Save"/>
</CommandBar>
</Pivot.RightHeader>
<PivotItem Header="View Progress">
</PivotItem>
<PivotItem Header="Progress Charts">
</PivotItem>
</Pivot>
Or at least, upon enetring the application, the dynamically added PivotItem is shown.
private void addElements()
{
calendar = getTheBloodyCalendar();
pivot = EntryPivot;
Grid calendarGrid = new Grid()
{
HorizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment = VerticalAlignment.Stretch
};
calendarGrid.Children.Add(calendar);
calendarItem = new PivotItem()
{
Header = "Calendar",
Content = calendarGrid
};
pivot.Items.Add(calendarItem);
}
Upvotes: 0
Views: 72
Reputation: 2927
Try using Insert method for inserting at a particular index
pivot.Items.Insert(0, calendarItem);
Upvotes: 2