Hello,
I've been trying to find a solution to this problem for a while but I can't seem to be able to find one.
My application contains a XamTilesControl, and each tile contains a ViewModel (I'm using MVVM, and the ItemsSource is bound to a collection of ViewModels which are in turn each bound to a Xaml usercontrol).
Some of those ViewModels contain graphs, others contain lists in the form of XamDatagrids.
The problem is that everytime I try to maximize one of the tiles, its content is re-created.
Some of these tiles take a while to load (pretty big lists or graphs), and maximizing causes the tab to reload everything again.
I managed to change the way my Viewmodel loads to avoid most of that, but it also causes the tile to lose all the changes that the user made in the controls contained by the tile (grouping or sorting in the XamDatagrid, or zooming in a graph, etc..).
Is there a way to avoid this?
Thanks,
Sébastien
Hi Joe,
When trying to recreate an sample on an existing MVVM demo application, I noticed that the problem only arises when I specify the different ItemTemplates (Maximized, minimized, etc..).
In the following sampnle, Workspaces is a collection of ViewModels (each ViewModel is bound as the datacontext of a WPF UserControl).
So the XamTilesControl is bound to the collection of Workspaces and each item template is bound to a single item from this collection.
That means that when I add a ViewModel to the collection, a tile is created with the UserControl corresponding to the added ViewModel.
When no Template is specified (default), the UserControl displays and can be maximized or minimized correctly without affecting the content, but once I set an ItemTemplate (for example for the maximized state), it reloads the content when the tile goes to that state.
Here is the strippped down sample (I've also attached the modified demo application to reproduce the problem) :
<igTiles:XamTilesControl ItemsSource="{Binding Path=Workspaces, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" TileCloseAction="RemoveItem" ItemContainerGenerationMode="PreLoad" > <igTiles:XamTilesControl.ItemTemplateMinimizedExpanded> <DataTemplate> <Viewbox Stretch="Uniform" Width="{Binding Width}" Height="{Binding Height}" MaxWidth="300" MaxHeight="400" MinHeight="50" MinWidth="50"> <ContentControl Content="{Binding}" MinHeight="400" MinWidth="400" /> </Viewbox> </DataTemplate> </igTiles:XamTilesControl.ItemTemplateMinimizedExpanded> <igTiles:XamTilesControl.ItemTemplateMinimized> <DataTemplate> <Viewbox Stretch="Uniform" Width="{Binding Width}" Height="{Binding Height}" MaxWidth="300" MaxHeight="200" MinHeight="50" MinWidth="50"> <ContentControl Content="{Binding}" MinHeight="400" MinWidth="400" /> </Viewbox> </DataTemplate> </igTiles:XamTilesControl.ItemTemplateMinimized> <igTiles:XamTilesControl.ItemTemplateMaximized> <DataTemplate> <ContentControl Content="{Binding}" Width="{Binding Width}" Height="{Binding Height}" MinWidth="300" MinHeight="300"/> </DataTemplate> </igTiles:XamTilesControl.ItemTemplateMaximized> <igTiles:XamTilesControl.ItemTemplate> <DataTemplate> <ContentControl Content="{Binding}" Width="{Binding Width}" Height="{Binding Height}" MinWidth="300" MinHeight="300" /> </DataTemplate> </igTiles:XamTilesControl.ItemTemplate> </igTiles:XamTilesControl>
Hi Sebastien,
I'm not sure what is going on here. When the Tile is maximized we don't touch the content.
It sounds like something to do with your user control. If you can post a stripped down sample that duplicates the problem I will take a look at it.
Otherwise you could submit a support request at http://ko.infragistics.com/support/submitrequest.aspx.