itemspanel - Weird ItemsPanelTemplate issue (possible Silverlight bug?) -


I am trying to create a horizontally oriented stack panel with a vertical oriented The item's stack panel is my code here.

The first XAML

  & lt; UserControl x: Class = "SilverlightApplication1.MainPage" xmlns = "http: // Schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns: x = "http://schemas.microsoft.com/winfx/2006/ Xaml "xmlns: d =" http://schemas.microsoft.com/ expression / mix / 2008 "xmlns: mc =" http://schemas.openxmlformats.org/markup-compatibility/2006 "& gt; & Lt; UserControl.Resources & gt; & Lt; DataTemplate x: key = "squirumplate" & gt; & Lt; Border margin = "2" background = "blue" width = "80" height = "80" /> & Lt; / DataTemplate & gt; & Lt; Datamapplet X: Key = "Wertilyt Eatam Template" & gt; & Lt; Items Controlled Items Source = "{Binding}" item template = "{static resource squirrelplate}" & gt; & Lt; ItemsControl.ItemsPanel & gt; & Lt; ItemsPanelTemplate & gt; & Lt; StackPanel Orientation = "Vertical" /> & Lt; / ItemsPanelTemplate & gt; & Lt; /ItemsControl.ItemsPanel> & Lt; / ItemsControl> & Lt; / DataTemplate & gt; & Lt; /UserControl.Resources> & Lt; Grid X: Name = "Layouts" & gt; & Lt; StackPanel Orientation = "Horizontal" & gt; & Lt; Items Controlled Items Source = "{Binding}" item template = "{static resource verticallated endemplate}" /> & Lt; / StackPanel & gt; & Lt; / Grid & gt; & Lt; / UserControl & gt;  

Now code-behind ...

  namespace SilverlightApplication1 {public partial class manpage: user control (public supervision collection & lt; Observeable collection & lt; Object & gt; & gt; _myCollection = New Observation Collection & Lt; Observeable Collection & lt; Object & gt; & gt; (); Public Observable Collection & lt; Observation Collection & lt; Object & gt; MyCollection {Refund {_myCollection;} Set {_myCollection = value;}} Public Menapause () {InitializeCompo Nent (); Layout.DataContact = Micronix; (Int i = 0; I & lt; 2; i ++) {var Internation = New Observe Collection & lt; Object & gt; (); (Int J = 0 ; {InnerCollection.Add (new object ());} _ my collection for J & lt; 3; J ++) add (intraction);}}}}  

me Expect to see two columns of three blue squares , but instead I a column of six squares

I think anything about the code Do not Who is clearly wrong on me ...

Any thoughts?

Thank you

You typed the root ItemsControl Code> StackPanel , when you actually want to insert the item in ItemsControl in StackPanel :

 < Code> & lt; Grid X: Name = "Layouts" & gt; & Lt; Items control items source = "{binding}" item template = "{static resource verticallyTiledItemTemplate}" & gt; & Lt; ItemsControl.ItemsPanel & gt; & Lt; ItemsPanelTemplate & gt; & Lt; StackPanel Orientation = "Horizontal" /> & Lt; / ItemsPanelTemplate & gt; & Lt; /ItemsControl.ItemsPanel> & Lt; / ItemsControl> & Lt; / Grid & gt;  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -