We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Using TileViewControl via Prism 7 BindableBase, with an ObservableCollection and adding items.

Thread ID:

Created:

Updated:

Platform:

Replies:

144035 Apr 15,2019 06:09 PM UTC Dec 23,2019 12:00 PM UTC WPF 7
loading
Tags: TileViewControl
Sheri Steeves
Asked On April 15, 2019 06:09 PM UTC

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.

Jagadeesan Pichaimuthu [Syncfusion]
Replied On 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

Jagadeesan Pichaimuthu [Syncfusion]
Replied On 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

Sheri Steeves
Replied On April 17, 2019 07:04 PM UTC

Thanks for sending the sample. It was not quite the same as my implementation. 

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

Jagadeesan Pichaimuthu [Syncfusion]
Replied On 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

Sheri Steeves
Replied On 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





Sabaridass Ramamoorthy [Syncfusion]
Replied On 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 


Niranjan Kumar Gopalan [Syncfusion]
Replied On 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. 

 
 
Regards, 
Niranjan Kumar Gopalan 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon