Using TileViewControl via Prism 7 BindableBase, with an ObservableCollection and adding items.
I am using Prism 7 and MVVM with the TileViewControl. My viewmodel, which contains an ObservableCollection, is derived from BindableBase, not INotifyCollectionChanged.
My TileViewControl is correctly populated with my initial items in the Observable collection, but does not update when I add an item through a command. The only way I see the new item is if I force a refresh by changing the window size.
My ViewModel has the following definition for the collection:
public class GridTileViewModel : BindableBase, INavigationAware
{
private ObservableCollection<ProfileInformation> _profiles;
public ObservableCollection<ProfileInformation> Profiles
{
get
{
return _profiles;
}
set
{
SetProperty(ref _profiles, value);
}
}
...
}
The command to add the new item is as follows:
private void CopyProfile()
{
if (_selectedProfile != null)
{
MessageBox.Show(String.Format("Copy profile button for Profile {0}.", _selectedProfile.ProfileName),
"Testing", MessageBoxButton.OK, MessageBoxImage.Information);
Profiles.Add(new ProfileInformation("Copy of " + _selectedProfile.ProfileName,
_selectedProfile.ProfileDescription,
!(_selectedProfile.CopyActionViewState != Visibility.Collapsed) ));
// Shouldn't have to do this and it doesn't fix the problem anyway
this.RaisePropertyChanged("Profiles");
}
}
The data context
My TileViewControl is in a usercontrol that I am placing into a Prism region, and uses a custom item style. I based this from the TileViewControl Data Binding sample, and modified the style template to what I wanted the tile to look like.
<syncfusion:TileViewControl x:Name="TilesGrid"
Grid.Row="1"
Margin="10, 0, 10, 10"
ItemsSource="{Binding Profiles, Mode=TwoWay}"
ItemContainerStyle="{StaticResource tileitemstyle}"
MinimizedItemsPercentage="0"
ClipToBounds="True"
IsVirtualizing="True"
VerticalScrollBarVisibility="Visible"
ColumnCount="4" RowCount="3"
SelectedItem="{Binding SelectedProfile}">
<syncfusion:TileViewControl.ItemTemplate>
<DataTemplate>
<local:ProfileTileView/>
</DataTemplate>
</syncfusion:TileViewControl.ItemTemplate>
</syncfusion:TileViewControl>
Why is the TileViewControl not updating when I add items to my ObservableCollection? I have a sample using the same control with code-behind and it works; but I don't want to use code behind; I need MVVM & Prism.
Thanks.
SIGN IN To post a reply.
7 Replies
JP
Jagadeesan Pichaimuthu
Syncfusion Team
April 16, 2019 01:41 PM UTC
Hi Sheri,
Thanks for using Syncfusion product.
We are currently checking your requirement in our end, so we will update the further details on April 17th, 2019.
Regards,
Jagadeesan
JP
Jagadeesan Pichaimuthu
Syncfusion Team
April 17, 2019 05:44 AM UTC
Hi Sheri ,
Thanks for your patience.
We have checked the possible way to reproduce the reported issue “TileViewControl not updating when I add items to my ObservableCollection”. We have prepared sample based on provided code snippet(using BindableBase), but still we are not able to reproduce issue at our end and do not know what we are missing at our side. Please find the video for the same from following link,
Please check the above video and let us know whether we follow the correct procedure to reproduce the issue and also conform us whether you can able to reproduce the same issue with the provided sample at your end. If not please provide the application with replication steps which reproduces the reported issue, that would helpful us to analyze and provide the solution at earliest.
Regards,
Jagadeesan
UN
Unknown
April 17, 2019 07:04 PM UTC
Thanks for sending the sample. It was not quite the same as my implementation.
Attachment: 04ViewDiscovery_59a3116e.zip
I am using Prism's Content region and view injection\loading to build the pieces of my UI.
I have included a sample that is a stripped down version of my current UI that exhibits the behavior.
When first opened, there are 10 tiles, and two empty "slots". Clicking Add tile adds the tile, but I don't see it unless
- I add another tile, in which case I only see the previous tile that I added, and not the two new ones
- or I resize the window.
Thanks
Attachment: 04ViewDiscovery_59a3116e.zip
JP
Jagadeesan Pichaimuthu
Syncfusion Team
April 18, 2019 06:14 AM UTC
Hi Sheri,
Thanks for your update.
We are able to reproduce the issue” TileViewControl not updating when I add items to my ObservableCollection”. Currently we are analyzing this issue and will update more details on 22/04/2019. Meanwhile we suggest you workaround to fix the reported issue by setting IsVirtualizing property as false. Please find the code snippet and sample for the same.
Code Snippet:
|
<syncfusion:TileViewControl x:Name="TilesGrid"
Grid.Row="1"
Margin="10, 0, 10, 10"
ItemsSource="{Binding Tiles, Mode=TwoWay}"
ItemContainerStyle="{StaticResource tileitemstyle}"
MinimizedItemsPercentage="0"
ClipToBounds="True"
IsVirtualizing="False"
VerticalScrollBarVisibility="Visible"
ColumnCount="4" RowCount="3"> |
Regards,
Jagadeesan
UN
Unknown
April 18, 2019 01:28 PM UTC
Hi Jagadeesan,
Thank you for the follow-up. Turning off virtualization does allow the tiles to be added to the empty places, but once the grid is full it then starts replacing the first tile's view, instead of adding to the bottom, and also the scroll bar is never enabled.
Will wait for your findings, lots of other development pieces to work on.
Sheri
SR
Sabaridass Ramamoorthy
Syncfusion Team
April 19, 2019 10:26 AM UTC
Hi Sheri,
Thanks for your update.
As we already stated, currently we are analyzing the reported query and we will update you the more details on 22/04/2019.
Regards,
Sabaridass R
NI
Ninja
Syncfusion Team
December 23, 2019 12:00 PM UTC
Hi Sheri,
Thanks for your patience.
We are able to reproduce the reported issue by the below sample and we logged it as defect and the fix will be included in Volume 4 SP1 release which will roll out by end of January 2020. Please refer the below feedback portal.
Sample link: https://www.syncfusion.com/downloads/support/directtrac/255394/ze/TileViewControl_sample(1)436244881.zip
Feedback : https://www.syncfusion.com/feedback/10939/docking-as-tabbed-window-does-not-works-properly
Regards,
Niranjan Kumar Gopalan
SIGN IN To post a reply.
- 7 Replies
- 4 Participants
-
UN Unknown
- Apr 15, 2019 06:09 PM UTC
- Dec 23, 2019 12:00 PM UTC