question

IDGO-6443 avatar image
IDGO-6443 asked ·

UWP - ListBox with 2 Columns with Border causing huge Peformance Issue.


UWP - ListBox with 2 Columns with Border causing huge Peformance Issue.

  <DataTemplate x:Name="TestTemplate">
                 <Border
                     Height="30"
                     Margin="0,0,0,-12"
                     HorizontalAlignment="Stretch"
                     BorderBrush="#A1A0A0"
                     BorderThickness="0,0,0,1">
                     <RelativePanel>
                         <TextBlock
                             x:Name="FirstTextBlock"
                             Width="300"
                             Margin="40,0,0,0"
                             VerticalAlignment="Center"
                             FontSize="14"
                             RelativePanel.AlignLeftWithPanel="True"
                             RelativePanel.LeftOf="Divider"
                             Text="{Binding Name}" />
                         <Border
                             x:Name="Divider"
                             Width="0.1"
                             Background="#ECECEC"
                             RelativePanel.AlignHorizontalCenterWithPanel="True" />
                         <TextBlock
                             x:Name="SecondTextBlock"
                             Margin="40,0,0,0"
                             VerticalAlignment="Center"
                             FontSize="14"
                             RelativePanel.AlignRightWithPanel="True"
                             RelativePanel.RightOf="Divider"
                             Text="{Binding ModuleName}" />
                     </RelativePanel>
                 </Border>
             </DataTemplate>

 <ListBox
                 x:Name="RoutineGrid"
                 Margin="5,0,5,0"
                 HorizontalAlignment="Stretch"
                 VerticalAlignment="Stretch"
                 HorizontalContentAlignment="Stretch"
                 Background="#FFFFFFFF"
                 ItemTemplate="{StaticResource TestTemplate}"
                 ItemsSource="{Binding TestCollection}"
                 SelectedItem="{Binding SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                 SelectionMode="Single">                
             </ListBox>

1 Column is Working Fine, But 2 Columns is causing issue, I need 2 Columns.

windows-uwpwindows-uwp-xaml
3 comments
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @IDGO-6443 , I did some tests, but there are no performance issues, it works fine. Can you provide a minimum runnable demo so that we can reproduce your problem. At the same time, you can try to replace Binding with x:Bind, as a compiled binding, it has a faster speed.

1 Vote 1 · ·
IDGO-6443 avatar image IDGO-6443 RichardZhang-MSFT ·

I am Using MVVM so x:Bind will not work......To reproduce you can Add 1 Lakh Dummy Data,

Try Loading 1 Column and Later 2 Columns you will find the difference.

@PeterFleischer-3316


0 Votes 0 · ·

Hello @IDGO-6443 , I tried to create 1000 simulation data. In single column, the application occupies about 29MB of memory, and dual columns occupies about 30MB of memory. No obvious performance problems have been observed. Can you provide a complete code example (Upload to Github or OneDrive) or detailed reproduction steps?

0 Votes 0 · ·

0 Answers