Nagu

hi here i'm trying to display some buttons in a stack panel horizontally an dit exceeds the screen visible area what i want is, to display what are the items are currently displayed now on the screen in ta text box. How can i do this (for this i'm using virtualizingStackPanel but i dont know how to use it exactly)

This is my code

<ListBox Name="lbox" Height ="80" virtualizingStackPanel.IsVirtualizing ="True">

<ListBoxItem Name="lbitem" HorizontalAlignment="Center">

<StackPanel width="Auto" Orientation ="Horizontal" Name="lbStackpanel" HorizontalAlignment="Center" Background="Black" virtualizingStackPanel.IsVirtualizing ="True"virtualizingStackPanel.IsVirtualizing ="True">

<Button>Button1</Button>

<Button>Button2</Button>

<Button>Button3</Button>

<Button>Button4</Button>

<Button>Button5</Button>

<Button>Button6</Button>

<Button>Button7</Button>

<Button>Button8</Button>

<Button>Button9</Button>

<Button>Button10</Button>

<Button>Button11</Button>

<Button>Button12</Button>

<Button>Button13</Button>

<Button>Button14</Button>

<Button>Button15</Button>

<Button>Button16</Button>

<Button>Button17</Button>

<Button>Button18</Button>

<Button>Button19</Button>

<Button>Button20</Button>

</StackPanel>

</ListBoxItem>

</ListBox>

Thanx-Nagu



Re: Windows Presentation Foundation (WPF) virtualizingStackPanel

Henry Hahn - MSFT

You need to use a DataSource to use the VirtualizationStackPanel. See http://windowssdk.msdn.microsoft.com/en-us/library/system.windows.controls.virtualizingstackpanel.aspx for info.




Re: Windows Presentation Foundation (WPF) virtualizingStackPanel

Marlon Grech

Hi,

can you please tell me what is the difference between

VirtualizingStackPanel.IsVirtualizing="True"

and

VirtualizingStackPanel.IsVirtualizing="False"

All I know is that if you use the first one it is much faster.... (I didn't try it yet....)

Thanks





Re: Windows Presentation Foundation (WPF) virtualizingStackPanel

PatLaplante12345

Marlon,

When a panel is virtualized it means that only the element visible are created. The rest aren't displayed.

For example, create a listbox displaying images bound to a folder holding 100,000 images. It would take a long time for the listbox to load. If you use a virtualize panel, then only the visible images will get created in the UI. When you scroll down, the currently visible will get destroyed and the new visible image will get loaded onto the UI.

There is only one panel that support virtualization and it is the VirtualizingStackPanel. If you need a wrap panel that virtualize, you will have to write your own.

Hope this helps.

Pat




Re: Windows Presentation Foundation (WPF) virtualizingStackPanel

Marlon Grech

Hi,

Thanks this is very helpful... just another small question...

Would you use the VirtualizingStackPanel even for a small amount of items

Regards
Marlon