Background skin and fixed layout in wpf

Please dont send me to the hang-tree for this and thanks for reading

  • This would be more a theoretical question. I've programmed a few years winforms lately someone asked me to make a custom design for a software.

  • After trying to draw it in winforms i saw that it can be very complicated.

  • Thats been said since i was looking for more simple way to work i draw a picture of the layout and applied it as background image on my form. Of course i started to have repainting performance issues since the app has a size of 1800x990. So i checked and applied the double buffering option but the performance is still a problem because i have a lot of controls.

    So i said it might be a good time to start learning WPF . From what i understand in WPF is better to allow auto-scale and self positioning of the controls using layout tools (grids, stacks ...). My app would have a fixed size (no resize) so i want to just to add the background which already contains the spaces for buttons and after that just add controls over it.

  • My question is : in terms of working with wpf is it wrong or not? If its not ok what would be the other aproach?

    Thanks in advance,

    Background 背景

    With controls placed

    附上按钮


    Yes WPF has much better layout controls that you can set to have fixed sizes, ratio scaling with or without min and max sizes. For example your top 5 boxes could be expressed like this to give a grid with 5 equal sized columns that resize along with the screen

    <Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>
    </Grid>
    

    You can nest grids within grids and other layout controls such as stack/wrap panels. Your layout would seem to be divided up into a root grid with 3 rows. The top row being another grid with 6 columns and 2 rows. The middle row is a simple grid with 1 column and row and the bottom row is a grid with 4 columns.

    Hope that helps

    链接地址: http://www.djcxy.com/p/84596.html

    上一篇: WPF Prism +现有的WPF应用程序

    下一篇: 背景皮肤和wpf中的固定布局