Great idea!
I don t use your solution exact, but I was inspired by your idea.
这就是我所做的:
1. 将堆叠板建成集装箱,设定负值的顶部差值,例如 Margin="0,-35,0,0"
2. 添加几个文本块以伪造紫外页头, 设定您打算与页眉捆绑的数据绑定 。
3. Set TextBlocks < seet TextBlocks>code> Width = "auto" ,加上一些右边边边距,以免过于拥挤
注:当第一个TextBlock代表当前的PivotTroject时,其他代表其他 -- -- 即未激活的 -- -- 。
4. 对于活性活性聚变项的文本锁,我们设置了 Foreground="#FF 7272772"
来与激活的区分。同时添加一个事件处理器,例如 Tap="GoToPivit2_Tap"
,其后面有简单的代码: PivotRooot.Sectroduced Text=Pivot2;
<controls:Pivot x:Name="PivotRoot">
<controls:PivotItem x:Name="Pivot1">
<StackPanel Margin="0,-35,0,0" Orientation="Horizontal">
<TextBlock Text="{Binding Header1}" Width="Auto" Margin="0,0,25,0" FontSize="30"/>
<TextBlock Text="{Binding Header2}" Tap="GoToPivot2_Tap" Width="Auto" Margin="0,0,25,0" Foreground="#FF727272" FontSize="30"/>
<TextBlock Text="{Binding Header3}" Tap="GoToPivot3_Tap" Width="Auto" Margin="0,0,25,0" Foreground="#FF727272" FontSize="30"/>
</StackPanel>
</controls:PivotItem>
<controls:PivotItem x:Name="Pivot2">
<StackPanel Margin="0,-35,0,0" Orientation="Horizontal">
<TextBlock Text="{Binding Header2}" Width="Auto" Margin="0,0,25,0" FontSize="30"/>
<TextBlock Text="{Binding Header3}" Tap="GoToPivot3_Tap" Width="Auto" Margin="0,0,25,0" Foreground="#FF727272" FontSize="30"/>
<TextBlock Text="{Binding Header1}" Tap="GoToPivot1_Tap" Width="Auto" Margin="0,0,25,0" Foreground="#FF727272" FontSize="30"/>
</StackPanel>
</controls:PivotItem>
<controls:PivotItem x:Name="Pivot3">
<StackPanel Margin="0,-35,0,0" Orientation="Horizontal">
<TextBlock Text="{Binding Header3}" Width="Auto" Margin="0,0,25,0" FontSize="30"/>
<TextBlock Text="{Binding Header1}" Tap="GoToPivot1_Tap" Width="Auto" Margin="0,0,25,0" Foreground="#FF727272" FontSize="30"/>
<TextBlock Text="{Binding Header2}" Tap="GoToPivot2_Tap" Width="Auto" Margin="0,0,25,0" Foreground="#FF727272" FontSize="30"/>
</StackPanel>
</controls:PivotItem>
</controls:Pivot>
就是这样。
事件可能不如你那么优雅,但也有效。