2016-11-22 8 views
5

पर गायब हो गया है मुझे अपने विंडोज 10 यूडब्ल्यूपी ऐप में यादृच्छिक रूप से आइकन और टेक्स्ट गायब होने में समस्या है।ऐपबार में आइकन और टेक्स्ट यादृच्छिक

enter image description here enter image description here

  1. चित्र पर शुरू है।

  2. तस्वीर एपबार बटन पर क्लिक करने के बाद है और इस प्रकार एक और पृष्ठ पर नेविगेट कर रहा है और फिर ऐप बार को फिर से खोल रहा है।

इस पर नियंत्रण के लिए XAML है:

<Grid DataContext="{Binding AppBarViewModel, Source={StaticResource ViewModelLocator}}"> 
    <StackPanel x:Name="LeftPanel" Orientation="Horizontal" Grid.Column="0" HorizontalAlignment="Left"> 
     <AppBarButton Width="100" x:Name="WelcomeButton" Label="{Binding ConverterParameter=Page_WelcomeTitleLabel, Converter={StaticResource trans}}" Command="{Binding WelcomeCommand}" Visibility="{Binding IsWelcomeButtomVisible, ConverterParameter=false, Converter={StaticResource BooleanToVisibilityConverter}}" > 
      <AppBarButton.Icon> 
       <BitmapIcon UriSource="ms-appx:///Assets/Icons/Home.png" /> 
      </AppBarButton.Icon> 
     </AppBarButton> 
     <AppBarButton Width="100" x:Name="ReportButton" Label="{Binding ConverterParameter=Page_ReportTitleLabel, Converter={StaticResource trans}}" Command="{Binding ReportCommand}" Visibility="{Binding IsReportButtonVisible, ConverterParameter=False, Converter={StaticResource BooleanToVisibilityConverter}}"> 
      <AppBarButton.Icon> 
       <BitmapIcon UriSource="ms-appx:///Assets/Icons/Report.png" /> 
      </AppBarButton.Icon> 
     </AppBarButton> 
     <AppBarButton Width="100" x:Name="IndividualPerformanceButton" Label="{Binding ConverterParameter=Page_IndividualPerformanceTitleLabel, Converter={StaticResource trans}}" Command="{Binding IndividualPerformanceCommand}" Visibility="{Binding IsIndividualButtonVisible, ConverterParameter=False, Converter={StaticResource BooleanToVisibilityConverter}}" > 
      <AppBarButton.Icon> 
       <BitmapIcon UriSource="ms-appx:///Assets/Icons/Individual overview.png" /> 
      </AppBarButton.Icon> 
     </AppBarButton> 
     <AppBarButton Width="100" x:Name="TeamOverviewButton" Label="{Binding ConverterParameter=Page_TeamOverviewTitleLabel, Converter={StaticResource trans}}" Command="{Binding TeamOverviewCommand}" Visibility="{Binding IsTeamOverviewButtonVisible, ConverterParameter=False, Converter={StaticResource BooleanToVisibilityConverter}}"> 
      <AppBarButton.Icon> 
       <BitmapIcon UriSource="ms-appx:///Assets/Icons/Team overview.png" /> 
      </AppBarButton.Icon> 
     </AppBarButton> 
     <AppBarButton Width="100" x:Name="TimeOverviewButton" Label="{Binding ConverterParameter=Page_TimeOverviewTitleLabel, Converter={StaticResource trans}}" Command="{Binding TimeOverviewCommand}" Visibility="{Binding IsTimeOverviewButtonVisible, ConverterParameter=False, Converter={StaticResource BooleanToVisibilityConverter}}"> 
      <AppBarButton.Icon> 
       <BitmapIcon UriSource="ms-appx:///Assets/Icons/Time overview.png" /> 
      </AppBarButton.Icon> 
     </AppBarButton> 
     <AppBarButton Width="100" x:Name="CoachingTipsButton" Label="{Binding ConverterParameter=Page_CoachingTipsTitleLabel, Converter={StaticResource trans}}" Command="{Binding CoachingTipsCommand}" Visibility="{Binding IsCoachingTipsButtonVisble, ConverterParameter=False, Converter={StaticResource BooleanToVisibilityConverter}}"> 
      <AppBarButton.Icon> 
       <BitmapIcon Visibility="Visible" UriSource="ms-appx:///Assets/Icons/Coaching tips.png" /> 
      </AppBarButton.Icon> 
     </AppBarButton> 
     <AppBarButton x:Name="SettingsButton" Label="{Binding ConverterParameter=Page_SettingsTitleLabel, Converter={StaticResource trans}}" Command="{Binding SettingsCommand}" Icon="Setting"/> 
    </StackPanel> 
</Grid> 

मैं कैसे डीबग कर सकते हैं क्यों पाठ और चिह्न यादृच्छिक पर गायब हो रहे हैं?

क्या किसी ने इससे पहले ऐसा कुछ अनुभव किया है?

+0

मैं आपको लगता है ' ठीक है, लेकिन वास्तव में मेरी समस्या का हल क्या हुआ 10586 बनाने के लिए लक्ष्य संस्करण स्थापित कर रहा था। –

उत्तर

6

आपकी प्रतिक्रिया के लिए धन्यवाद। मैं विंडोज 10, संस्करण 1607 के साथ समान व्यवहार देख सकता हूं।

आम तौर पर, AppBarButton में दो आकार हैं; सामान्य और कॉम्पैक्ट। डिफ़ॉल्ट रूप से, यह एक टेक्स्ट लेबल और पूर्ण पैडिंग के साथ दिखाया गया है। हालांकि विंडोज 10, संस्करण 1607 (विंडोज एसडीके संस्करण 10.0.14393.0) में शुरूआत में, यह लेबलपोजिशन अवधारणा पेश करता है, इसके साथ हम बटन के लेबल की प्लेसमेंट और दृश्यता निर्दिष्ट कर सकते हैं।

लेकिन लेबलपोजिशनCommandBar.DefaultLabelPosition संपत्ति द्वारा निर्दिष्ट किया गया है। डिफ़ॉल्ट रूप से, आइकन के नीचे एक ऐप बार बटन का लेबल प्रदर्शित होता है। हम इस संपत्ति को आइकन के दाईं ओर लेबल दिखाने या लेबल छिपाने के लिए सेट कर सकते हैं। हालांकि AppBarButton में AppBarButton.LabelPosition property है, लेकिन इसका मान केवल Default and Collapsed हो सकता है जबकि Default का भी अर्थ है कि ऐप बार बटन के लेबल की नियुक्ति और दृश्यता CommandBar.DefaultLabelPosition संपत्ति के मान द्वारा निर्धारित की जाती है।

अपने कोड में, आप AppBarButton एस StackPanel पर CommandBar पर डाल रहे हैं। इस परिदृश्य में, क्योंकि DefaultLabelPosition नहीं है, AppBarButton एस यादृच्छिक रूप से लेबल दिखाते हैं। तो कभी-कभी आप लेबल को देख सकते हैं, कभी-कभी नहीं और कभी-कभी आइकन आइकन के दाईं ओर प्रदर्शित होता है। (यदि आप अपने AppBarButton में Width="100" निकालते हैं, तो आप आइकन न केवल लेबल को देखने के लिए सक्षम हो shuold।)

हम इस मुद्दे को आंतरिक रूप से सूचना दी है और मैं अद्यतन करेगा मेरा उत्तर एक बार कोई प्रगति है। एक कामकाज के रूप में, आप StackPanel के बजाय CommandBar का उपयोग कर सकते हैं। यदि आप अभी भी StackPanel का उपयोग करना चाहते हैं, तो आप AppBarButton के डिफ़ॉल्ट टेम्पलेट को संपादित कर सकते हैं।

हम "देखें" → "अन्य विंडोज" → "दस्तावेज़ को रेखांकित करें" खोलने से दृश्य स्टूडियो में डिफ़ॉल्ट शैली और "दस्तावेज़ को रेखांकित करें" के साथ टेम्पलेट पा सकते हैं।

फिर "दस्तावेज़ को रेखांकित करें" में एक AppBarButton और दाएँ क्लिक चुनने के बाद "टेम्पलेट संपादन" → "एक कॉपी संपादित करें ..."।यह पॉपअप करेगा "स्टाइल संसाधन बनाएं" संवाद। चूंकि हमें सभी AppBarButton एस पर नई शैली लागू करने की आवश्यकता है, हम "सभी पर लागू करें" चुन सकते हैं। और डिफ़ॉल्ट रूप से यह Page.Resources के तहत डिफ़ॉल्ट शैली उत्पन्न करेगा।

डिफ़ॉल्ट शैली में, हम केवल "रूट" Grid रूप में अच्छी तरह के रूप में LabelOnRight तहत LabelOnRightStyle बाहर टिप्पणी करने की जरूरत है और निम्नलिखित की तरह टेम्पलेट मेंVisualState LabelCollapsed:

<Style TargetType="AppBarButton"> 
    <Setter Property="Template"> 
     <Setter.Value> 
      <ControlTemplate TargetType="AppBarButton"> 
       <Grid x:Name="Root" 
         MinWidth="{TemplateBinding MinWidth}" 
         MaxWidth="{TemplateBinding MaxWidth}" 
         Background="{TemplateBinding Background}" 
         BorderBrush="{TemplateBinding BorderBrush}" 
         BorderThickness="{TemplateBinding BorderThickness}"> 
        <!--<Grid.Resources> 
         <Style x:Name="LabelOnRightStyle" TargetType="AppBarButton"> 
          <Setter Property="Width" Value="NaN" /> 
         </Style> 
        </Grid.Resources>--> 
        <VisualStateManager.VisualStateGroups> 
         <VisualStateGroup x:Name="ApplicationViewStates"> 
          <VisualState x:Name="FullSize" /> 
          <VisualState x:Name="Compact"> 
           <Storyboard> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextLabel" Storyboard.TargetProperty="Visibility"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" /> 
            </ObjectAnimationUsingKeyFrames> 
           </Storyboard> 
          </VisualState> 
          <!--<VisualState x:Name="LabelOnRight"> 
           <Storyboard> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Margin"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="12,14,0,14" /> 
            </ObjectAnimationUsingKeyFrames> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="MinHeight"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarThemeCompactHeight}" /> 
            </ObjectAnimationUsingKeyFrames> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextLabel" Storyboard.TargetProperty="(Grid.Row)"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="0" /> 
            </ObjectAnimationUsingKeyFrames> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextLabel" Storyboard.TargetProperty="(Grid.Column)"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="1" /> 
            </ObjectAnimationUsingKeyFrames> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextLabel" Storyboard.TargetProperty="TextAlignment"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="Left" /> 
            </ObjectAnimationUsingKeyFrames> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextLabel" Storyboard.TargetProperty="Margin"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="8,15,12,17" /> 
            </ObjectAnimationUsingKeyFrames> 
           </Storyboard> 
          </VisualState>--> 
          <!--<VisualState x:Name="LabelCollapsed"> 
           <Storyboard> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="MinHeight"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarThemeCompactHeight}" /> 
            </ObjectAnimationUsingKeyFrames> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextLabel" Storyboard.TargetProperty="Visibility"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" /> 
            </ObjectAnimationUsingKeyFrames> 
           </Storyboard> 
          </VisualState>--> 
          <VisualState x:Name="Overflow"> 
           <Storyboard> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="Visibility"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" /> 
            </ObjectAnimationUsingKeyFrames> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OverflowTextLabel" Storyboard.TargetProperty="Visibility"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" /> 
            </ObjectAnimationUsingKeyFrames> 
           </Storyboard> 
          </VisualState> 
          <VisualState x:Name="OverflowWithToggleButtons"> 
           <Storyboard> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="Visibility"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" /> 
            </ObjectAnimationUsingKeyFrames> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OverflowTextLabel" Storyboard.TargetProperty="Visibility"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" /> 
            </ObjectAnimationUsingKeyFrames> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OverflowTextLabel" Storyboard.TargetProperty="Margin"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="38,0,12,0" /> 
            </ObjectAnimationUsingKeyFrames> 
           </Storyboard> 
          </VisualState> 
         </VisualStateGroup> 
         <VisualStateGroup x:Name="CommonStates"> 
          <VisualState x:Name="Normal"> 
           <Storyboard> 
            <PointerUpThemeAnimation Storyboard.TargetName="OverflowTextLabel" /> 
           </Storyboard> 
          </VisualState> 
          <VisualState x:Name="PointerOver"> 
           <Storyboard> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Background"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonBackgroundPointerOver}" /> 
            </ObjectAnimationUsingKeyFrames> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="BorderBrush"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonBorderBrushPointerOver}" /> 
            </ObjectAnimationUsingKeyFrames> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonForegroundPointerOver}" /> 
            </ObjectAnimationUsingKeyFrames> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextLabel" Storyboard.TargetProperty="Foreground"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonForegroundPointerOver}" /> 
            </ObjectAnimationUsingKeyFrames> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OverflowTextLabel" Storyboard.TargetProperty="Foreground"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonForegroundPointerOver}" /> 
            </ObjectAnimationUsingKeyFrames> 
            <PointerUpThemeAnimation Storyboard.TargetName="OverflowTextLabel" /> 
           </Storyboard> 
          </VisualState> 
          <VisualState x:Name="Pressed"> 
           <Storyboard> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Background"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonBackgroundPressed}" /> 
            </ObjectAnimationUsingKeyFrames> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="BorderBrush"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonBorderBrushPressed}" /> 
            </ObjectAnimationUsingKeyFrames> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonForegroundPressed}" /> 
            </ObjectAnimationUsingKeyFrames> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextLabel" Storyboard.TargetProperty="Foreground"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonForegroundPressed}" /> 
            </ObjectAnimationUsingKeyFrames> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OverflowTextLabel" Storyboard.TargetProperty="Foreground"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonForegroundPressed}" /> 
            </ObjectAnimationUsingKeyFrames> 
            <PointerDownThemeAnimation Storyboard.TargetName="OverflowTextLabel" /> 
           </Storyboard> 
          </VisualState> 
          <VisualState x:Name="Disabled"> 
           <Storyboard> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Background"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonBackgroundDisabled}" /> 
            </ObjectAnimationUsingKeyFrames> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="BorderBrush"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonBorderBrushDisabled}" /> 
            </ObjectAnimationUsingKeyFrames> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonForegroundDisabled}" /> 
            </ObjectAnimationUsingKeyFrames> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextLabel" Storyboard.TargetProperty="Foreground"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonForegroundDisabled}" /> 
            </ObjectAnimationUsingKeyFrames> 
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OverflowTextLabel" Storyboard.TargetProperty="Foreground"> 
             <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarButtonForegroundDisabled}" /> 
            </ObjectAnimationUsingKeyFrames> 
           </Storyboard> 
          </VisualState> 
         </VisualStateGroup> 
         <VisualStateGroup x:Name="InputModeStates"> 
          <VisualState x:Name="InputModeDefault" /> 
          <VisualState x:Name="TouchInputMode"> 
           <VisualState.Setters> 
            <Setter Target="OverflowTextLabel.Padding" Value="0,11,0,13" /> 
           </VisualState.Setters> 
          </VisualState> 
          <VisualState x:Name="GameControllerInputMode"> 
           <VisualState.Setters> 
            <Setter Target="OverflowTextLabel.Padding" Value="0,11,0,13" /> 
           </VisualState.Setters> 
          </VisualState> 
         </VisualStateGroup> 
        </VisualStateManager.VisualStateGroups> 
        <Grid x:Name="ContentRoot" MinHeight="{ThemeResource AppBarThemeMinHeight}"> 
         <Grid.ColumnDefinitions> 
          <ColumnDefinition Width="*" /> 
          <ColumnDefinition Width="Auto" /> 
         </Grid.ColumnDefinitions> 
         <Grid.RowDefinitions> 
          <RowDefinition Height="Auto" /> 
          <RowDefinition Height="Auto" /> 
         </Grid.RowDefinitions> 
         <ContentPresenter x:Name="Content" 
              Height="20" 
              Margin="0,14,0,4" 
              HorizontalAlignment="Stretch" 
              AutomationProperties.AccessibilityView="Raw" 
              Content="{TemplateBinding Icon}" 
              Foreground="{TemplateBinding Foreground}" /> 
         <TextBlock x:Name="TextLabel" 
            Grid.Row="1" 
            Margin="2,0,2,6" 
            FontFamily="{TemplateBinding FontFamily}" 
            FontSize="12" 
            Foreground="{TemplateBinding Foreground}" 
            Text="{TemplateBinding Label}" 
            TextAlignment="Center" 
            TextWrapping="Wrap" /> 
        </Grid> 
        <TextBlock x:Name="OverflowTextLabel" 
           Margin="12,0,12,0" 
           Padding="0,5,0,7" 
           HorizontalAlignment="Stretch" 
           VerticalAlignment="Center" 
           FontFamily="{TemplateBinding FontFamily}" 
           FontSize="15" 
           Foreground="{TemplateBinding Foreground}" 
           Text="{TemplateBinding Label}" 
           TextAlignment="Left" 
           TextTrimming="Clip" 
           TextWrapping="NoWrap" 
           Visibility="Collapsed" /> 
       </Grid> 
      </ControlTemplate> 
     </Setter.Value> 
    </Setter> 
</Style> 
+0

हाय, जय, क्या यह सीयू :-) में हल किया गया था? –

संबंधित मुद्दे