开发者

Minimum resizing

开发者 https://www.devze.com 2023-03-22 16:11 出处:网络
Inside a grid have a ContentControl inside a Grid where I load a UserControl.开发者_如何学Python

Inside a grid have a ContentControl inside a Grid where I load a UserControl.开发者_如何学Python

I want the user to resize the window, but how can I prevent resizing-down the window so it will be less the the user control?

In other words, user control should be always visible on the window.

<Grid>
   <Border>
     <ContentControl  Content="{Binding Path=THeModel}">
     </ContentControl>            

   </Border>
</Grid>


Use the MinWidth and MinHeight properties of the Window to set a minimum width and height.

<Window MinWidth="200" MinHeight="200" ... > ... </Window>

If it depends on its content, you can try binding these properties to the ActualWidth/ActualHeight of another control:

<Window MinWidth="{Binding ElementName=MyControl, Path=ActualWidth}" ... > ... </Window>

But this will only work well if MyControl has a fixed size - if it grows with the window, then the results will not be ideal.

0

精彩评论

暂无评论...
验证码 换一张
取 消