c# - Silverlight - How do I make each item in a list box be the same height? -
How can I create a Silverlight list box in which all the items are of the same size and take 100% of the listbox height To wit. 1 item will be the height of the list item, 2 items will be 50% of the height of each list box ...
Edit - Here is the code
Public Class Uniform Panel: Panel {Safe Override Size Major Override (Size Available Size) {Size Panel Speed Size = New Size (); For (int i = 0; i & lt; kids.Count; i ++) {UIElement child = children [i]; Child.Measure (availableSize); Var childDesiredSize = child.DesiredSize; Panel design size. HEIGHT = = Child size. Light; If (panelDesiredSize.Width
I see, only you need Get the total hat / items in the item. Correct Points ... In that case you can create columns with the Uniform Grid (which already exists as part of the platform) and 1 = You can use the following XAML
& Lt; List Box Vertical Contentelment = "Statchch" Horizontal Content Elementment = "Stretch" & gt; & Lt; ListBox.ItemsPanel & gt; & Lt; ItemsPanelTemplate & gt; & Lt; Uniform Grid IsItemsHost = "True" Column = "1" /> & Lt; / ItemsPanelTemplate & gt; & Lt; /ListBox.ItemsPanel> & Lt; Button / & gt; & Lt; Button / & gt; & Lt; Button / & gt; & Lt; / ListBox & gt;
UPDATE: Silverlight does not have a uniform grid, but you can get one which I keep from the WPF in Silverlight
Comments
Post a Comment