Note that there are some explanatory texts on larger screens.

plurals
  1. POListView Multiple Columns with Virtualization?
    text
    copied!<p>I have a ListView and am using a uniform grid to allow the data within the listview to flow into two columns.</p> <p>I am not 100% happy with the blue highlighting on the ListView so maybe it's not the best UI elements for my needs, but my highest priority is keeping the VirtaulingStackPanel effect (without it my UI lags because of all the items I have). When I add the Uniform Grid code it lags, when I take it out it doesn't lag.</p> <p>So my question is if there is some property I am overriding by choosing to use a UniformGrid that I need to set in order to get Virtualizing back.</p> <p>I was also wondering if there was a better UI element I was unaware of for my needs. And also if there is a way to let the number of columns be dynamic and expand to meet avialable space instead of being hardcoded in.</p> <p>Below is my XAML code.</p> <p>Thanks! Wesley</p> <pre><code>&lt;ListView Name="points"&gt; &lt;ListView.ItemsPanel&gt; &lt;ItemsPanelTemplate&gt; &lt;UniformGrid Columns="2" /&gt; &lt;/ItemsPanelTemplate&gt; &lt;/ListView.ItemsPanel&gt; &lt;ItemsControl.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;StackPanel Margin="2" Orientation="Horizontal"&gt; &lt;TextBlock Width="65" Text="{Binding [3]}" /&gt; &lt;StackPanel Margin="2,0,2,2"&gt; &lt;TextBox Height="22" MaxLength="28" Width="300" Margin="2,0,2,2" Text="{Binding [2]}" /&gt; &lt;ComboBox Width="300" ItemsSource="{Binding [1]}" SelectedIndex="{Binding [0]}" /&gt; &lt;/StackPanel&gt; &lt;/StackPanel&gt; &lt;/DataTemplate&gt; &lt;/ItemsControl.ItemTemplate&gt; &lt;/ListView&gt; </code></pre> <p>EDIT 1:</p> <p>The following code allows dynamic columns but still no Virtualization.</p> <pre><code> &lt;ListView.ItemsPanel&gt; &lt;ItemsPanelTemplate&gt; &lt;WrapPanel Width="{Binding (FrameworkElement.ActualWidth), RelativeSource={RelativeSource AncestorType=ScrollContentPresenter}}" ItemWidth="{Binding (ListView.View).ItemWidth, RelativeSource={RelativeSource AncestorType=ListView}}" MinWidth="{Binding ItemWidth, RelativeSource={RelativeSource Self}}" ItemHeight="{Binding (ListView.View).ItemHeight, RelativeSource={RelativeSource AncestorType=ListView}}" /&gt; &lt;/ItemsPanelTemplate&gt; &lt;/ListView.ItemsPanel&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload