WPF: How to autosize Path to its container?

前端 未结 4 563
闹比i
闹比i 2021-01-17 09:37

I have a Path that must resize to its StackPanel container.


    

        
4条回答
  •  星月不相逢
    2021-01-17 10:03

    Any reason why you're not using a ViewBox for this? That will shrink or grow the path as needed. If you don't want it scaled, but rather clipped, then set the clipping mode to be restricted to the control's bounding box. (I'd wrap the path in a ContentPresenter for that.)

提交回复
热议问题