How to create/make rounded corner buttons in WPF?

前端 未结 12 2139
礼貌的吻别
礼貌的吻别 2020-12-04 11:39

I need to create a rounded corner glossy button in WPF. Can anyone please explain me what steps are needed?

12条回答
  •  眼角桃花
    2020-12-04 12:11

    Well the best way to get round corners fast and with standard animation is to create a copy of the control template with Blend. Once you get a copy set the corner radius on the Grid tag and you should be able to have your control with full animation functionality and applyable to any button control. look this is the code:

            
        
            
                
                    
                        
                            
                        
                    
                    
                        
                            
                                
                            
                            
                                
                            
                            
                                
                            
                            
                        
                    
                    
                        
                            
                                
                            
                            
                                
                            
                            
                                
                            
                            
                        
                    
                    
                        
                            
                                
                            
                            
                                
                            
                            
                                
                            
                        
                    
                
            
            
                
            
                
    
    

    I also edited the VisualState="PointerOver" specifically at Storyboard.TargetName="BorderBrush", because its ThemeResource get squared corners whenever PointerOver triggers.

    Then you should be able to apply it to your control style like this:

    
    

    So you can apply your styles to any Button.

提交回复
热议问题