// 构造函数 public MainPage() { InitializeComponent(); this.DataContext = App.MainViewModel; App.MainViewModel.LoadChannels(); for (int i = 0; i < CommonData.LockedChannel.Count; i++) { if (CommonData.LockedChannel[i].channelName == "精选" || CommonData.LockedChannel[i].channelName == "热榜") { PivotItemControl pivot = new PivotItemControl(CommonData.LockedChannel[i]); pivot.pivotItem.DataContext = CommonData.LockedChannel[i]; MainPivot.Items.Add(pivot.pivotItem); } } for (int i = 0; i < CommonData.NormalChannel.Count; i++) { if (CommonData.NormalChannel[i].channelName == "精选" || CommonData.NormalChannel[i].channelName == "热榜" ) { PivotItemControl pivot = new PivotItemControl(CommonData.NormalChannel[i]); pivot.pivotItem.DataContext = CommonData.NormalChannel[i]; MainPivot.Items.Add(pivot.pivotItem); } } MainPivot.SelectedIndex = 2; }
// 构造函数 public MainPage() { InitializeComponent(); this.DataContext = App.MainViewModel; App.MainViewModel.LoadChannels(); for (int i = 0; i < CommonData.LockedChannel.Count; i++) { if (CommonData.LockedChannel[i].channelName == "精选" || CommonData.LockedChannel[i].channelName == "热榜") { PivotItemControl pivot = new PivotItemControl(CommonData.LockedChannel[i]); pivot.pivotItem.DataContext = CommonData.LockedChannel[i]; MainPivot.Items.Add(pivot.pivotItem); } } for (int i = 0; i < CommonData.NormalChannel.Count; i++) { if (CommonData.NormalChannel[i].channelName == "精选" || CommonData.NormalChannel[i].channelName == "热榜") { PivotItemControl pivot = new PivotItemControl(CommonData.NormalChannel[i]); pivot.pivotItem.DataContext = CommonData.NormalChannel[i]; MainPivot.Items.Add(pivot.pivotItem); } } MainPivot.SelectedIndex = 2; }