WPF rounded corner textbox

前端 未结 6 448
谎友^
谎友^ 2020-11-30 01:32

I don\'t know WPF and am now learning it. I was looking for rounded corners TextBox in WPF. So I searched Google and found a piece of XAML :

<
6条回答
  •  误落风尘
    2020-11-30 02:29

    In WPF you can modify or recreate the look and feel of controls. So if your example what they have done is they changed the appearance of the TextBox by modifying the ControlTemplate of the existing TextBox. So to see and explore the piece of code just use the below code

    
    
        
             
                
            
            
                
                    
                    
                
                
                    
                
                
                    
                
            
        
    
    
        
    
    

    So we have declared a static resource in the Resource section of the Window and we have used the Resource TextBoxBaseControlTemplate in the Template property of the TextBox as Template="{StaticResource TextBoxBaseControlTemplate}" .

    Templates to Customize WPF Controls just refere this document to get an idea

    http://msdn.microsoft.com/en-us/magazine/cc163497.aspx

提交回复
热议问题