Change shape of WPF button without changing other styles

后端 未结 3 1790
耶瑟儿~
耶瑟儿~ 2021-01-04 23:56

I would like to change the shape of a WPF button from the default round rectangle to another shape (say, an arrow), but I want to keep the rest of the styling -- fill color,

3条回答
  •  爱一瞬间的悲伤
    2021-01-05 00:42

    Make a copy of the default Button Template, and simply change the default panel to your own custom shape.

    In the case of the button, it looks like you need to replace the Border with something like a Path defining an Arrow.

    Since a Path doesn't have content, you'll probably have to put both the shape and the content in another panel which allows objects to overlap, such as a Grid.

    So your end result will look something like this

    
        
        
    
    

    instead of the default

    
    

提交回复
热议问题