2017-08-24 6 views
1

フォーカスされたピボットアイテムの青い下線が表示されない理由を知っている人はいますか?UWPピボット:フォーカスされたピボットアイテムの青いアンダーラインなし

<Pivot> 
    <PivotItem Header="Testt 1">Test 1</PivotItem> 
    <PivotItem Header="Testt 2">Test 2</PivotItem> 
    <PivotItem Header="Testt 3">Test 3</PivotItem> 
</Pivot> 

及びMSはデフォルトでは、ピボット・ヘッダ上のキーボードフォーカスがある」と言っている:(.NETコア2.0と新しく作成された空のUWPアプリで、VS 2017 15.3.2)XAMLはそのような単純です下線で表されています。 (https://docs.microsoft.com/en-us/windows/uwp/controls-and-patterns/tabs-pivot

スタートアップの後、最初のピボットアイテムにはあったが、別のピボットアイテムをクリックしてから消えた。 PivotHeaderItemのスタイルインサイド

+1

"スタートアップの後、最初のピボットアイテムにはあったが、別のピボットアイテムをクリックしても消えてしまった。"クリックする代わりにそれらの間をタブするとどうなりますか?それは結局のところキーボードの焦点を言う。スタートアップ後もまだ何もしていなければ、そこにいたら驚くかもしれません。 – BoltClock

+0

ああ、そうです、それが現れます!クリック/タップするとどうすれば表示されますか? – IngoB

答えて

1

、あなたはキーボードナビゲーション中に表示することを視覚的焦点であるFocusPipeと呼ばれるRectangleがあります。デフォルトでは、Focused状態のときにのみ表示されます。

あなたはそれが見えるようにしたい場合は、単に、SelectedSelectedPressedSelectedPointerOver状態をそのVisibilityVisibleに設定してください。

<Application.Resources> 
    <Style TargetType="PivotHeaderItem"> 
     <Setter Property="FontSize" 
       Value="{ThemeResource PivotHeaderItemFontSize}" /> 
     <Setter Property="FontFamily" 
       Value="{ThemeResource PivotHeaderItemFontFamily}" /> 
     <Setter Property="FontWeight" 
       Value="{ThemeResource PivotHeaderItemThemeFontWeight}" /> 
     <Setter Property="CharacterSpacing" 
       Value="{ThemeResource PivotHeaderItemCharacterSpacing}" /> 
     <Setter Property="Background" 
       Value="{ThemeResource PivotHeaderItemBackgroundUnselected}" /> 
     <Setter Property="Foreground" 
       Value="{ThemeResource PivotHeaderItemForegroundUnselected}" /> 
     <Setter Property="Padding" 
       Value="{ThemeResource PivotHeaderItemMargin}" /> 
     <Setter Property="Height" 
       Value="48" /> 
     <Setter Property="VerticalContentAlignment" 
       Value="Center" /> 
     <Setter Property="IsTabStop" 
       Value="False" /> 
     <Setter Property="Template"> 
      <Setter.Value> 
       <ControlTemplate TargetType="PivotHeaderItem"> 
        <Grid x:Name="Grid" 
          Background="{TemplateBinding Background}" 
          Padding="{TemplateBinding Padding}"> 
         <VisualStateManager.VisualStateGroups> 
          <VisualStateGroup x:Name="SelectionStates"> 
           <VisualStateGroup.Transitions> 
            <VisualTransition From="Unselected" 
                 To="UnselectedLocked" 
                 GeneratedDuration="0:0:0.33" /> 
            <VisualTransition From="UnselectedLocked" 
                 To="Unselected" 
                 GeneratedDuration="0:0:0.33" /> 
           </VisualStateGroup.Transitions> 
           <VisualState x:Name="Disabled"> 
            <Storyboard> 
             <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" 
                     Storyboard.TargetProperty="Foreground"> 
              <DiscreteObjectKeyFrame KeyTime="0" 
                    Value="{ThemeResource PivotHeaderItemForegroundDisabled}" /> 
             </ObjectAnimationUsingKeyFrames> 
             <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Grid" 
                     Storyboard.TargetProperty="Background"> 
              <DiscreteObjectKeyFrame KeyTime="0" 
                    Value="{ThemeResource PivotHeaderItemBackgroundDisabled}" /> 
             </ObjectAnimationUsingKeyFrames> 
            </Storyboard> 
           </VisualState> 
           <VisualState x:Name="Unselected" /> 
           <VisualState x:Name="UnselectedLocked"> 
            <Storyboard> 
             <DoubleAnimation Storyboard.TargetName="ContentPresenterTranslateTransform" 
                 Storyboard.TargetProperty="X" 
                 Duration="0" 
                 To="{ThemeResource PivotHeaderItemLockedTranslation}" /> 
             <DoubleAnimation Storyboard.TargetName="ContentPresenter" 
                 Storyboard.TargetProperty="(UIElement.Opacity)" 
                 Duration="0" 
                 To="0" /> 
            </Storyboard> 
           </VisualState> 
           <VisualState x:Name="Selected"> 
            <VisualState.Setters> 
             <Setter Target="FocusPipe.Visibility" 
               Value="Visible" /> 
            </VisualState.Setters> 
            <Storyboard> 
             <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" 
                     Storyboard.TargetProperty="Foreground"> 
              <DiscreteObjectKeyFrame KeyTime="0" 
                    Value="{ThemeResource PivotHeaderItemForegroundSelected}" /> 
             </ObjectAnimationUsingKeyFrames> 
             <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Grid" 
                     Storyboard.TargetProperty="Background"> 
              <DiscreteObjectKeyFrame KeyTime="0" 
                    Value="{ThemeResource PivotHeaderItemBackgroundSelected}" /> 
             </ObjectAnimationUsingKeyFrames> 
            </Storyboard> 
           </VisualState> 
           <VisualState x:Name="UnselectedPointerOver"> 
            <Storyboard> 
             <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" 
                     Storyboard.TargetProperty="Foreground"> 
              <DiscreteObjectKeyFrame KeyTime="0" 
                    Value="{ThemeResource PivotHeaderItemForegroundUnselectedPointerOver}" /> 
             </ObjectAnimationUsingKeyFrames> 
             <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Grid" 
                     Storyboard.TargetProperty="Background"> 
              <DiscreteObjectKeyFrame KeyTime="0" 
                    Value="{ThemeResource PivotHeaderItemBackgroundUnselectedPointerOver}" /> 
             </ObjectAnimationUsingKeyFrames> 
            </Storyboard> 
           </VisualState> 
           <VisualState x:Name="SelectedPointerOver"> 
            <VisualState.Setters> 
             <Setter Target="FocusPipe.Visibility" 
               Value="Visible" /> 
            </VisualState.Setters> 
            <Storyboard> 
             <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" 
                     Storyboard.TargetProperty="Foreground"> 
              <DiscreteObjectKeyFrame KeyTime="0" 
                    Value="{ThemeResource PivotHeaderItemForegroundSelectedPointerOver}" /> 
             </ObjectAnimationUsingKeyFrames> 
             <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Grid" 
                     Storyboard.TargetProperty="Background"> 
              <DiscreteObjectKeyFrame KeyTime="0" 
                    Value="{ThemeResource PivotHeaderItemBackgroundSelectedPointerOver}" /> 
             </ObjectAnimationUsingKeyFrames> 
            </Storyboard> 
           </VisualState> 
           <VisualState x:Name="UnselectedPressed"> 
            <Storyboard> 
             <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" 
                     Storyboard.TargetProperty="Foreground"> 
              <DiscreteObjectKeyFrame KeyTime="0" 
                    Value="{ThemeResource PivotHeaderItemForegroundUnselectedPressed}" /> 
             </ObjectAnimationUsingKeyFrames> 
             <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Grid" 
                     Storyboard.TargetProperty="Background"> 
              <DiscreteObjectKeyFrame KeyTime="0" 
                    Value="{ThemeResource PivotHeaderItemBackgroundUnselectedPressed}" /> 
             </ObjectAnimationUsingKeyFrames> 
            </Storyboard> 
           </VisualState> 
           <VisualState x:Name="SelectedPressed"> 
            <VisualState.Setters> 
             <Setter Target="FocusPipe.Visibility" 
               Value="Visible" /> 
            </VisualState.Setters> 
            <Storyboard> 
             <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" 
                     Storyboard.TargetProperty="Foreground"> 
              <DiscreteObjectKeyFrame KeyTime="0" 
                    Value="{ThemeResource PivotHeaderItemForegroundSelectedPressed}" /> 
             </ObjectAnimationUsingKeyFrames> 
             <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Grid" 
                     Storyboard.TargetProperty="Background"> 
              <DiscreteObjectKeyFrame KeyTime="0" 
                    Value="{ThemeResource PivotHeaderItemBackgroundSelectedPressed}" /> 
             </ObjectAnimationUsingKeyFrames> 
            </Storyboard> 
           </VisualState> 
          </VisualStateGroup> 
          <VisualStateGroup x:Name="FocusStates"> 
           <VisualState x:Name="Focused"> 
            <VisualState.Setters> 
             <Setter Target="FocusPipe.Visibility" 
               Value="Visible" /> 
            </VisualState.Setters> 
           </VisualState> 
           <VisualState x:Name="Unfocused" /> 
          </VisualStateGroup> 
         </VisualStateManager.VisualStateGroups> 
         <Grid.RenderTransform> 
          <TranslateTransform x:Name="ContentPresenterTranslateTransform" /> 
         </Grid.RenderTransform> 
         <ContentPresenter x:Name="ContentPresenter" 
              Content="{TemplateBinding Content}" 
              ContentTemplate="{TemplateBinding ContentTemplate}" 
              FontSize="{TemplateBinding FontSize}" 
              FontFamily="{TemplateBinding FontFamily}" 
              FontWeight="{TemplateBinding FontWeight}" 
              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
              VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
              OpticalMarginAlignment="TrimSideBearings" /> 
         <Rectangle x:Name="FocusPipe" 
            Fill="{ThemeResource PivotHeaderItemFocusPipeFill}" 
            Height="2" 
            VerticalAlignment="Bottom" 
            HorizontalAlignment="Stretch" 
            Visibility="Collapsed" /> 
        </Grid> 
       </ControlTemplate> 
      </Setter.Value> 
     </Setter> 
    </Style> 
</Application.Resources> 
+1

偉大な、それは動作します!どうもありがとう。 :) – IngoB

関連する問題