Simulating a mousehover effect on a fontIcon in uwp

后端 未结 2 570
挽巷
挽巷 2021-01-27 15:36

Am currently working on a uwp project involving the use of a hamburger menu. So far I generated the menu using this code



        
2条回答
  •  Happy的楠姐
    2021-01-27 16:06

    Update You cant do that in XAMl. If you want to do in XAMl Use button instead and edit Visual state of Button

     
    
     
    

    You can do like this

         
    
       private void FontIcon_PointerPressed(object sender, PointerRoutedEventArgs e)
            {
                (sender as FontIcon).Foreground = new SolidColorBrush(Colors.White);
            }
    
            private void FontIcon_PointerEntered(object sender, PointerRoutedEventArgs e)
            {
                (sender as FontIcon).Foreground = new SolidColorBrush(Colors.White);
            }
    
            private void FontIcon_PointerExited(object sender, PointerRoutedEventArgs e)
            {
                (sender as FontIcon).Foreground = new SolidColorBrush(Colors.Black);
            }
    

提交回复
热议问题