2016-04-12 12 views
0

スクリーンショットのようなビューを作成するには?次の項目にドラッグすると、ヘッダーも移動しますが、コンテンツよりも遅くなり、色が変わります。ゆっくり動くヘッダーでFlipViewを作成するには? UWP

View with headers; example

+1

使用ピボット制御:コードビハインドで

<Pivot Name="MyPivot" SelectionChanged="ListView_SelectionChanged"> <PivotItem> <PivotItem.Header> <TextBlock Foreground="White" Text="Hello" /> </PivotItem.Header> <TextBlock>When headers are in 'Dynamic' mode, hovering a mouse over the pivot headers will show mouse flippers for easy tab switching </TextBlock> </PivotItem> <PivotItem> <PivotItem.Header> <TextBlock Foreground="White" Text="Keyboard Support" /> </PivotItem.Header> <TextBlock> <Run>Pivot now supports the following keyboard behaviors</Run><LineBreak /> <Run> * While the HeaderPanel is focused:</Run><LineBreak /> <Run> * * Left, Right, Ctrl+PgUp, Ctrl+PgDown: Changes the currently selected PivotItem</Run><LineBreak /> <Run> * * Down: Sets focus in the content area</Run><LineBreak /> <Run> * While the Content area is focused:</Run><LineBreak /> <Run> * * Ctrl+PgUp, Ctrl+PgDown: Changes the currently selected PivotItem</Run> </TextBlock> </PivotItem> </Pivot> 

Archana

答えて

0

FlipViewヘッダーを設定するプロパティを提供しません。 @Archanaが言ったように、あなたはPivotを使うことができます。 Pivotを使用しているGitHubの公式サンプルがあります。このサンプルは、UWPアプリケーションでPivotコントロールを使用する方法を示しています。

HeaderPivotItemに設定できます。ヘッダーとアイテムは関連付けられているため、ヘッダーが変更されるとすぐにアイテムが変更されます。逆に、項目が変更されるとすぐにヘッダーが変更されます。私が知っているように、ヘッダーの外観を遅らせる方法はありません。

選択したヘッダーのテキストの色を変更することができます。 PivotItem.Headerの内容にTextBlockを追加できます。また、イベントをPivotに追加することもできます。例えば

private void MyPivot_SelectionChanged(object sender, SelectionChangedEventArgs e) 
{ 
    foreach (PivotItem pivotItem in MyPivot.Items) 
    { 
     if (pivotItem == MyPivot.Items[MyPivot.SelectedIndex]) 
     { 
      ((TextBlock)pivotItem.Header).Foreground = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 255, 255, 255)); 
     } 
     else 
     { 
      ((TextBlock)pivotItem.Header).Foreground = new SolidColorBrush(Windows.UI.Color.FromArgb(115, 123, 120, 130)); 
     } 
    } 
} 
関連する問題