Customizing the toggle state of a toggle button in wpf

前端 未结 4 692
我在风中等你
我在风中等你 2020-12-30 11:48

I wanna customize the toggle state of the toggle button in wpf. I want to set a image to the toggle button when it is on and set another image when it is off. TO do so, i th

4条回答
  •  无人及你
    2020-12-30 12:10

    This answer will help you. In there I took a ToggleButton and styled it to look as the ToggleButton in a TreeView (the + / - part to expand collapse nodes). You'll just need to change the paths that draw the - and + signs, to show your images instead.

    Here goes personalized to you, just put an image called "on.jpg" and another one called "off.jpg" under your C:\ directory, and it should work by just copy/pasting into your window:

        
            
            
                
                                         
                
                
                    
                        
                    
                
            
            
        
        
            
        
    

提交回复
热议问题