Creating a sidebar - flyout like Windows desktop app in WPF

后端 未结 2 1497
孤城傲影
孤城傲影 2021-02-09 14:01

what i am trying to do is create a Desktop application in WPF whose UI is such that a small icon will remain fixed in the center of the left edge of screen and on click(or maybe

2条回答
  •  长发绾君心
    2021-02-09 14:24

    Something like this could work:

    then of course you could create a slide in animation for the sidebar. This shows (partial) transparency and the switching principle.

    XAML:

    
        
            
                
                
            
            
            
        
    
    

    C#:

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        if (rect.Visibility == System.Windows.Visibility.Collapsed)
        {
            rect.Visibility = System.Windows.Visibility.Visible;
            (sender as Button).Content = "<";
        }
        else 
        {
            rect.Visibility = System.Windows.Visibility.Collapsed;
            (sender as Button).Content = ">";
        }        
    }
    

提交回复
热议问题