简体   繁体   中英

How to bind data like gridview using listbox in windows phone

In my app i want to bind data like gridview.Since there is no gridview for windows phone and listbox shows data vertically .How to achieve this. Here is my code

<ListBox x:Name="listbox">
   <ListBox.ItemTemplate>
      <DataTemplate>
         <StackPanel Orientation="Horizontal" Width="200" Height="200" Background="Blue"/>
      </DataTemplate>
   </ListBox.ItemTemplate>
</ListBox>

How to show template like windows 8 start screen.?

You could do it this way..

<listbox itemssource="{Binding MyList}" scrollviewer.horizontalscrollbarvisibility="Auto" scrollviewer.verticalscrollbarvisibility="Disabled">
<listbox.itemspanel>
    <itemspaneltemplate>
        <!-- Could be a VirtualizingStackPanel if you wish -->
        <stackpanel orientation="Horizontal">
    </stackpanel></itemspaneltemplate>
</listbox.itemspanel>
<listbox.itemtemplate>
    <datatemplate>
        <!-- Style set to enhance need for scrolling -->
        <textblock style="{StaticResource PhoneTextExtraLargeStyle}" text="{Binding}">
    </textblock></datatemplate>
</listbox.itemtemplate>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM