How to make the contents of a round-cornered border be also round-cornered?

后端 未结 7 1778
天涯浪人
天涯浪人 2020-11-27 14:11

I have a border element with rounded corners containing a 3x3 grid. The corners of the grid are sticking out of the border. How can I fix that? I tried using ClipToBounds bu

7条回答
  •  醉酒成梦
    2020-11-27 14:38

    As Micah mentioned ClipToBounds will not work with Border.ConerRadius.

    There is UIElement.Clip property, which Border inheritances.

    If you know the exact size of the border, then here is the solution:

    
          
            
          
          
    
    

    If the size is not known or dynamic then Converter for Border.Clip can be used. See the solution here.

提交回复
热议问题