Creating Pivot Footers on Windows phone 7 application

后端 未结 2 564
旧时难觅i
旧时难觅i 2021-01-16 14:19

I know that pivot control of windows phone has two parts pivot headers and pivot item control.

what i want to display is, pivot headers below the pivot item control

2条回答
  •  不思量自难忘°
    2021-01-16 14:47

    I have the solution. You need to inherit from Pivot control and switch headers row with items row:

      public class PivotFooter : Pivot
      {
        public override void OnApplyTemplate()
        {
          base.OnApplyTemplate();
    
          var headers = base.GetTemplateChild("HeadersListElement") as PivotHeadersControl;
          var items = base.GetTemplateChild("PivotItemPresenter") as ItemsPresenter;
    
          var grid = headers.Parent as Grid;
          if(grid != null)
          {
            var firstHeight = grid.RowDefinitions[1].Height;
            var secondHeight = grid.RowDefinitions[2].Height;
    
            grid.RowDefinitions[1].Height = secondHeight;
            grid.RowDefinitions[2].Height = firstHeight;    
          }
    
          headers.SetValue(Grid.RowProperty, 2);
          items.SetValue(Grid.RowProperty, 1);
        }
      }
    

提交回复
热议问题