Building up a Layout–WPF Study
2011-12-24 16:02 一一九九 阅读(177) 评论(0) 收藏 举报Following is a list of recommendations to help you in your interface design:
- begin by using the simplest and most explicti Panel.
- Do not be afraid to combine multiple panels to achieve the effect you desire.
- pay close attention to the runtime behavior of your layout. you may need to your stategy to accommodate window resizing.
- try to choose layout options that allows for flexible sizing . Avoid seting hardcoded height and width properties when possible. instead, if necessary, consider using minHeight, MinWidth,maxHeight,and maxWidth. These properties give wpf’s layout engine some flexible parameters by which it can work, rather than force it into a brittle layout strategy.
- if using a graphical UI tool such as Vs designer or Expression Blend, keep a colose eye on the Margin properties of your elements. Sometimes these tools get confused and alter these values in strange ways, resulting in unexpected layout behavior.
- Use Canvas only as a last resort. This panel was designed primarily for rendering Drawings, not UI. using Canvas for ordinary layout scenariors can defeat hte purpose of the WPF dynamic layout capabilities. if you want a similar effect, use a grid control in combination with margin set on its children. this create a sort of relative canvas effect.
From <Sams. teach yourself wpf in 24 hours in Jun 2008>
浙公网安备 33010602011771号