yuri_Niko
yuri_Niko

Reputation: 1

Minimum resizing

Inside a grid have a ContentControl inside a Grid where I load a UserControl.
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>

Upvotes: 0

Views: 1480

Answers (1)

Ross
Ross

Reputation: 4578

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.

Upvotes: 1

Related Questions