Creating a custom-shaped button with one rounded corner

后端 未结 1 1256
栀梦
栀梦 2020-12-03 17:58

I need to create a button in WPF that has a custom shape. Specifically, I want it to have rounded corners, like an ellipse. Here is a picture:

1条回答
  •  一生所求
    2020-12-03 18:18

    You could use a ControlTemplate to achieve that:

    
    

    Than you apply it to the button:

    If you need some references to draw the "Path" check this MSDN link.

    Update

    To show the content you should use a ContentPresenter, something like this:

    
    

    In the button:

    
    

    enter image description here

    0 讨论(0)
提交回复
热议问题