0

I have a listbox which looks like this:

<ListBox ItemsSource="{Binding Clients}">
    <ListBox.ItemTemplate>
        <DataTemplate>
            <controls:ClientItem />
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

There are several tabs in my window and the Clients collection is constructed depending on a selected tab. The problem is that the ClientItem constructor is called every time I switch the tabs, and the gui works slowly. There are normally 10-20 clients in the listbox and I can see in the vs profiler that a ClientItem constructor consumes the most part of time.

Is it possible to tell wpf not to create ClientItem view if it already exists?

Oleg Ignatov
  • 877
  • 2
  • 8
  • 22

0 Answers0