WPF user control does not resize with main window

前端 未结 2 1435
情歌与酒
情歌与酒 2021-01-05 00:34

I\'m trying to make a WPF user control that includes two group boxes and two ListViews in each group box. Here is the XAML code for the user control:

         


        
相关标签:
2条回答
  • 2021-01-05 00:50

    İf You Use a ViewBox and a Canvas on your user control will fix all the mainwindow sizes

    <Viewbox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Stretch="Uniform">
    
      <canvas>
    
    --- all your controls -- 
    
         </Canvas>
            </Viewbox>
    
    0 讨论(0)
  • 2021-01-05 00:59

    You're specifying the Height and Width properties as fixed values in the UserControl. Remove those properties, and set the HorizontalAlignment and VerticalAlignment properties of the control instance in the main window to Stretch. That should take care of it.

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