Wednesday 15 June 2011

WPF alignment stretch -


Can someone help me understand the WPF vibe alignment I often go into issues where I'm going to some area Need control for filling, but I have never understood what level at which vertical alignment = "stretch" should be placed. Especially when user controls are included.

I always solve the problem by trying various things or by straining at all levels, but I understand how to do it properly.

For example, I have now found:

  • I have a grid with a fixed size cell (which should be replaced with a grid-splitter I have a UserControl in this cell that has a StackPanel TabControl with
  • I have TabItems in TabControl which contains a ListView

Is another UserControl or some in Pseudo XAML

  & lt; Ns: MyUserControl1 Grid.Row = "0" grid. Column = "0" & ​​gt; & Lt ;! - This MyUserControl1 - & gt; & Lt; StackPanel & gt; & Lt; TabControl & gt; & Lt; TabItem & gt; & Lt; Ns: MyUserControl2 & gt; & Lt ;! - This is in MyUserControl2 - & gt; & Lt; ListView / & gt; & Lt; / Ns: MyUserControl2 & gt; & Lt; / TabItem & gt; & Lt; / TabControl & gt; & Lt; / StackPanel & gt; & Lt; / Ns: MyUserControl & gt;  

Now I want ListView to fill the entire grid cell (except TabControl and Fringe).

Your list view will fill your MyUserControl2 - if you want to fit it across the entire tab You will need to make sure that you remove the height and width of the useramontrol in the xaml file (this will be the default for each)

Edit: Apologies - I have an important part of your xaml Left ... MyUserControl1 container is a stackpane ... it pile up hair controls and theirs Will change the shape to fit; If you change it with a dockpanel (or grid), then hair control will fill the available space and will give you results later ...

Take a look at the MSDN article ... hopefully help Does


No comments:

Post a Comment