Stretch items to fill canvas

前端 未结 2 1137
一整个雨季
一整个雨季 2021-01-01 15:21

I have a Dockpanel with items inside a Canvas. The Dockpanel and any other items (Grid etc) that I place inside the Canvas, only take up their minimum required space. How do

2条回答
  •  生来不讨喜
    2021-01-01 15:49

    What you can do is:

    
        
            
        
        
            
        
    
    

    By wrapping both panels in a grid like this you can place elements that you cant to position relative to left, top etc in the canvas. Both the canvas and the dockpanel will fill available space. Note that the elements in the dockpanel will be rendered above the elements in the canvas when the dockpanel is defined after in xaml.

    I'm assuming the code you posted is pseudo code, if not you should just remove the canvas.

提交回复
热议问题