CustomLabels don't notice ObservableCollection changes

(Tested with 18.3)

We have `CustomLabels` bound to an ObservableCollection:

        public ObservableCollection<Syncfusion.Windows.Controls.Input.Items> Labels { get; set; }
            = new ObservableCollection<Syncfusion.Windows.Controls.Input.Items>();

        <sf:SfRangeSlider ShowCustomLabels="True" CustomLabels="{Binding Labels}" LabelPlacement="BottomRight" />

This works initially. However, the control doesn't seem to listen to any changes to the collection later on — neither if I call ObservableCollection.Clear() or ObservableCollection.Add(), nor if I explicitly call OnPropertyChanged(nameof(Labels)).

If I explicitly access the slider itself in the view model and change the Slider.CustomLabels, the labels do get updated, but that's more of a workaround (and I have performance concerns). So, this works, but this isn't great:

            //if (Slider != null)
            //{
            //    Slider.CustomLabels = null; // explicitly null to trigger a change
            //    Slider.CustomLabels = Labels;
            //}

Is there something I can do to explicitly trigger a labels update (preferably without needing to access the control from the view model), or is this supposed to work automatically?

8 Replies 1 reply marked as answer

KG Kanimozhi Gunasekaran Syncfusion Team April 2, 2021 04:14 PM UTC

Hi Soeren Kuklau,

Greetings from Syncfusion.

We are currently validating on the reported issue and we will update the complete details on or before April 7, 2021.

We appreciate your patience until then.

Regards,
Kanimozhi G.  
 



AS Anandraj Selvam Syncfusion Team April 7, 2021 12:05 PM UTC

Hi Soeren Kuklau, 
  
Thanks for the patience. 
  
We have analyzed your query. We were able to reproduce the issue and we confirm this as a bug and logged a defect report. You can keep track of the bug from the feedback portal below. 
  
  
The provided feedback link is private, and you need to login to view this feedback. 
  
The fix for the reported issue will be available on 20th April, 2021. 
  
If you have any more specification/precise replication procedure or a scenario to be tested, you can add it as a comment in the portal. 
  
Regards, 
Anand Raj S.  



JK Jeya Kasipandi Syncfusion Team April 21, 2021 11:07 AM UTC


Hi Soeren KuKlau,

Thanks for the patience.

We have fixed the reported issue and please find the patch from the following location.

Please find the patch setup from below location:

https://syncfusion.com/Installs/support/patch/19.1.0.54/148378/F164122/SyncfusionPatch_19.1.0.54_148378_4212021062643643_F164122.exe
(OR)

Please find the patch assemblies alone from below location:

https://syncfusion.com/Installs/support/patch/19.1.0.54/148378/F164122/SyncfusionPatch_19.1.0.54_148378_4212021062643643_F164122.zip

(OR)

Please find the NuGet from below location:

https://syncfusion.com/Installs/support/patch/19.1.0.54/148378/F164122/SyncfusionNuget_19.1.0.54_148378_4212021062643643_F164122.zip
Assembly Version: 19.1.0.54

Disclaimer:

Please note that we have created this patch for version 19.1.0.54 specifically, to resolve the issue reported in this. If you have received other patches for the same version for other products, please apply all patches in the order received.

Note: Please clear the NuGet cache, before using the latest one.

https://www.syncfusion.com/kb/6987/how-to-clear-nuget-cache

The fix for the reported issue will be included in our upcoming weekly nuget release which is expected to be rolled out on April 27, 2020.We appreciate your patience until then.

Regards,
Jeya K


 



SS Suganya Sethuraman Syncfusion Team April 28, 2021 04:36 AM UTC

Hi Soeren KuKlau,

Thanks for your patience.

We have included the issue fix in our today Weekly NuGet release update version 19.1.0.58 which is available for download (https://www.nuget.org/ ).

You can resolve the mentioned issue by upgrading NuGet to the most recent version and using the suggested workaround below, which we addressed in a previous update.

Please let us know if you have any other queries.

Regards,
Suganya Sethuraman.
 


Marked as answer

SK Soeren Kuklau April 28, 2021 10:49 AM UTC

Hello Suganya Sethuraman,

I can confirm that it now works if I Clear() the collection each time. If, however, I merely assign new values to existing items (e.g. Labels[3] = "example";), the control doesn't seem to notice a change. Is this by design?

Thanks


SS Suganya Sethuraman Syncfusion Team April 29, 2021 10:06 AM UTC

Hi Soeren,

Thanks for the update.

We have analyzed your query. When we assign a new value to an existing item of Items(Model class), ObservableCollection is not notified. This is a behavior. To accomplish this, we have to create new Items (Model class) and assign to collection as shown in the code snippet below,

Code snippet
 
        private void Button_Click(object sender, RoutedEventArgs e) 
        { 
             VM.CustomCollection[0] = new Items() { label = "example", value = 100 }; 
        } 

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/RangeSliderNotify-850011588

Please check if the sample satisfies your requirement and let us know if you have any concerns.

Regards,
Suganya Sethuraman.
 



SK Soeren Kuklau May 5, 2021 09:47 AM UTC

Thanks!


SS Suganya Sethuraman Syncfusion Team May 6, 2021 06:35 AM UTC

Hi Soeren,

Thanks for the update.

We are glad to know that the given solution works. Please let us know if you need any further assistance.

Regards,
Suganya Sethuraman.
 


Loader.
Up arrow icon