The size of the wpf control changes with the size of the form.
WPF can be implemented directly by setting the horizontal and vertical Alighment of the graphic controls to Stretch.
You can use a ViewBox to mount all the Window content and then zoom in and out together when the window is scaled.
The display mechanism of ViewBox is to display the sub-control according to the logical size in the memory, and then display the sub-control in proportional scaling to the customer area of ViewBox.
Example:
Button btn = new Button (); btn. HorizontalAlignment = System. Windows. HorizontalAlignment. Stretch; btn. verticalignment = System. Windows. verticalignment. Stretch;
Same implementation in xmal
All content in the window of WPF changes with the size of the window.
// Use ViewBox. ViewBox has a Stretch attribute, which is the same as the Image's Stretch attribute. The enumerated values are as follows:
// Keep the original size of the None content.
// Adjust the content size of Fill to Fill the target size. Do not retain the aspect ratio.
// Adjust the content size while retaining the original aspect ratio of the content to fit the target size.
// UniformToFill retains the original aspect ratio of the content and adjusts the content size to fill the target size. If the aspect ratio of the target rectangle is different from the aspect ratio of the source rectangle, the source content is cropped to fit the target size.
// ViewBox usage:
<Window>
<ViewBox Stretch = "Uniform">
<Grid> </Grid>
</ViewBox>
</Window>
// I hope my answer will help you.
C # wpf wants the control to change with the window size
Use expression blend to design the wpf front-end. feihonggang888 is feasible.