silverlight - How to strech items in itemcontrol -


So I'm trying to do some things in objects so that horizontally spread and when you look at the following code, So you can see that I am very disappointed I simplified my code and added some colors to better see what control starts and ends, where ... items are equally spaced across horizontal There is a possibility of spreading and filling?

  & lt; Grid Background = "Red" Horizontal Alignment = "Statch" Vertical Element = "Stretch" & gt; & Lt; Grid.ColumnDefinitions & gt; & Lt; Column width = "*" /> & Lt; /Grid.ColumnDefinitions> & Lt; ItemControl x: Name = "horizontal lightbox" background = "blue" horizontal alignment = "statchch" horizontal content alignment = "stretch" & gt; & Lt; ItemsControl.Items & gt; & Lt; System: Int32 & gt; 4 & lt; / System: Int32 & gt; & Lt; System: Int32 & gt; 4 & lt; / System: Int32 & gt; & Lt; System: Int32 & gt; 4 & lt; / System: Int32 & gt; & Lt; System: Int32 & gt; 4 & lt; / System: Int32 & gt; & Lt; System: Int32 & gt; 4 & lt; / System: Int32 & gt; & Lt; /ItemsControl.Items> & Lt; ItemsControl.Template & gt; & Lt; ControlTemplate & gt; & Lt; Items Presentation Horizontal Alliance = "Stretch" /> & Lt; / ControlTemplate & gt; & Lt; /ItemsControl.Template> & Lt; ItemsControl.ItemsPanel & gt; & Lt; ItemsPanelTemplate & gt; & Lt; StackPanel Orientation = "Horizontal" horizontal alignment = "statch" /> & Lt; / ItemsPanelTemplate & gt; & Lt; /ItemsControl.ItemsPanel> & Lt; ItemsControl.ItemTemplate & gt; & Lt; DataTemplate & gt; & Lt; Grid Background = "Green" vertical alignment = "statch" horizontal align = "stretch" & gt; & Lt; Text block text = "test" horizontal align = "stretch" /> & Lt; / Grid & gt; & Lt; / DataTemplate & gt; & Lt; /ItemsControl.ItemTemplate> & Lt; / ItemsControl> & Lt; / Grid & gt;  

It looks like:

Although I was expecting the possibility of spreading green objects in all places.

EDIT: Thanks, the blogpost found in the answer given below worked with some adjustments:

  protected overhead shape Measurement measure (size is available) {var size = new size (); Set side (ref size, gate-side (available size)); Exotic hair (UiIlement children in children) {Children. Measure (available size); Set author side (ref size, math max. (Getuper side), getupsideide (kid's design size)); } _measureSize = size; Return size; } Organize protected override sizes Override (size final size) {Double offset = 0; Foreign children (UiIlement children in children) {double side = gate-side (_misersize) / children. Var final = new size (); Set side (ref final, side); Set author side (ref finalist, getupside (final shot)); Child.Arrange (GetOffsetPoint (offset), last)); Offset + = side; } Return final size; }  

Looks like you need StretchPanel . There is no such panel in Silverlight, but you can write your own. I got through a google, just had a quick look at the code and it looks fine for me

  & lt; ItemsControl.ItemsPanel & gt; & Lt; ItemsPanelTemplate & gt; & Lt; StretchPanel Orientation = "Horizontal" /> & Lt; / ItemsPanelTemplate & gt; & Lt; /ItemsControl.ItemsPanel>  

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -