Hi Dev.eloper,
At first, I recommend you to translate this thread to English, that all community members on this forum can understand this question and help you. Or you could post it on the Chinese MSDN forum: http://social.msdn.microsoft.com/Forums/zh-CN/wpfzhchs/threads
Then, regarding to this question, you would like to auto-match the screen size and auto-change the size of all controls. Yes, agree with Yiling Lai, WPF layout provides and supports it. WPF provides two panel: Grid and DockPanel can help you to achieve this goal.
If you put any control in the Grid panel, and set the Margin property of the control to some value (please do not set the Height and Width properties, that will fix the size of the control). The control can match the size of the Grid and change to the different size when changing the Grid size. A simple sample, in a Grid, the Button and TextBlock can fill and match the Window size:
<Window x:Class="WpfApplication12.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <TextBlock Text="Hello World!" Margin="100,100,100,100"/> <Button Content="Button" Margin="100,120,100,100"/> </Grid></Window>
Please refer to the Layout in WPF: http://msdn.microsoft.com/en-us/library/ms745058.aspx Panels Overview: http://msdn.microsoft.com/en-us/library/ms754152.aspx and a video http://windowsclient.net/learn/video.aspx?v=76354
On the other hand, WPF does no support to change the font text automatically. But if we put the elements in the ViewBox with Stretch property to some value (like Uniform). The inner element can match the size of the ViewBox and the TextBlock can show the appropriate "font size":
<Grid> <Viewbox Stretch="Uniform"> <TextBlock Text="Hello World!"/> </Viewbox> </Grid>
Sincerely,
Bob Bao
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Are you looking for a typical code sample? Please download
all in one code framework !
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com