滚动时为什么ListBox显示速度慢?标签对齐很好。但是当我滚动(超过500行)时,它滚动得很好,但重新对齐列的速度很慢。
有更快的方法吗?
在xlam我有:
<ListBox Margin="10,10,10,10" Grid.IsSharedSizeScope="True" x:Name="gLBxDbContactInfo" >
<ListBox.ItemTemplate>
<DataTemplate>
<Grid> <!--used for tab locations-->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" SharedSizeGroup="Col0"/>
<ColumnDefinition Width="Auto" SharedSizeGroup="Col1"/>
...
<ColumnDefinition Width="Auto" SharedSizeGroup="Col9"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding tabNameLastFirst}"/>
<TextBlock Grid.Column="1" Text="{Binding tabAdr}"/>
...
<TextBlock Grid.Column="9" Text="{Binding tabOtherInfo}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
在.cs中我有
//=================
public class ListBoxTabs
{
public string tabNameLastFirst { get; set; }
public string tabAdr { get; set; }
...
public string tabOtherInfo { get; set; }
}// class ListBoxTabs
//=================
和
for (int ii = 0; ii < iNum; ii++)
{
g.ParseStringToListst(gliststDbData[ii], liststParsed, '\t');
listItems.Add(new ListBoxTabs() {
tabNameLastFirst = liststParsed[0],
tabAdr = " " + liststParsed[4],
...
tabOtherInfo = " " + liststParsed[12]
});
liststParsed.Clear();
}