I have a control that uses a ParentObject as its DataContext. The ParentObject has a property called ChildObject that may change. When it does, ParentObject raises the PropertyChanged event.
The control has XAML to define a ListView for the items in the List property of the ChildObject. When the ChildObject property changes in the ParentObject, the entire view is recreated, meaning that new controls are instantiated.
The ListView is actually much more complicated than the example below, so recreating it is processor intensive and takes a long time.
What are my other options? Can I cache the entire ListView for each ChildObject? How would I go about doing that?
<ListView ItemsSource="{Binding ParentObject.ChildObject.List}">
<ListView.View>
<GridView>
<GridViewColumn Header="Error">
<GridViewColumn.CellTemplate>
<DataTemplate>
<local:ErrorControl DataContext="{Binding ErrorCollection}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>