1

Comment puis-je régler une opacité de ApplicationBar quand il s'ouvre et quand il se ferme dans Windows Phone. Il est l'événement onle ove:comment puis-je régler une opacité de ApplicationBar

<phone:PhoneApplicationPage.ApplicationBar> 
     <shell:ApplicationBar x:Name="AppBar_FeedPivotPage" Opacity="0.5" ForegroundColor="Black" BackgroundColor="White" StateChanged="AppBar_FeedPivotPage_StateChanged"> 

private void GlobalAppBar_StateChanged(object sender, ApplicationBarStateChangedEventArgs e) 
    { 
     ApplicationBar appBar = (ApplicationBar)sender; 
     var opacity = appBar.Opacity; 
     if (opacity == 0.5) 
     { 

      appBar.Opacity == 1; 
     } 
     else 
     { 
      appBar.Opacity == 0.95; 
     } 
    } 

Mais il y a exeption de référence null

Répondre

3

Essayez d'utiliser l'argument sender comme suit:

private void AppBar_FeedPivotPage_StateChanged(object sender, ApplicationBarStateChangedEventArgs e) 
    { 
    ApplicationBar appBar = (ApplicationBar)sender; 
    var opacity = appBar.Opacity; 
    } 
+0

J'ai mis à jour ma question – revolutionkpi

+0

Comment puis-je modifier l'opacité? – revolutionkpi