This is a migrated thread and some comments may be shown as answers.

Control does not get refreshed when ItemSource binding changes

3 Answers 64 Views
DataBoundListBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jagoba
Top achievements
Rank 1
Jagoba asked on 10 Sep 2013, 09:01 PM
Hi.

I have a DataBoundListBox:
<telerikPrimitives:RadDataBoundListBox
            x:Name="ListBox"
            ItemsSource="{Binding Data}"
            IsSynchronizedWithCurrentItem="False"
            EmptyContentDisplayMode="DataSourceEmpty"
            ListHeaderContent="{Binding}"
            ListFooterContent="{Binding}"
            DataVirtualizationMode="OnDemandAutomatic"
            DataRequested="ListBox_OnDataRequested"
            telerikCore:InteractionEffectManager.IsInteractionEnabled="True"
        ItemTap="ListBoxTopic_OnItemTap"
           SelectedItem="{Binding SelectedDataItem}"
        SelectionChanged="ListBox_OnSelectionChanged"
           IsAsyncBalanceEnabled="True"
            AsyncBalanceMode="FillViewportFirst"
            >

My itemtemplate has some binded properties with converters like:

<Border Margin="0,0,0,0"  VerticalAlignment="Bottom" BorderThickness="0" Background="{Binding isFavorite, Converter={StaticResource booleanToAccentBrushConverter}, ConverterParameter=DarkGray}" Visibility="{Binding number, Converter={StaticResource booleanToVisibilityConverter}}">

If in my viewModel I modify the ObservableCollection Data, and set one of the items in Data to Data[0].isFavorite = true, then i call RaisePropertyChange("Data") and  the listbox item isnt refresed reflecting my change. This cahnge only gets refelcted if I scroll down and lose the item from the screen. Next I scroll up and the item reappears modified correctly.
Is there anyway I can force item repaint? I think the item isnt refreshed because it is already in realized items and the controls does not repaint it.

3 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 11 Sep 2013, 09:02 AM
Hello Jagoba,

Thanks for writing and for the code snippets.

In your scenario, when changing a property on your Business Entity, you need to raise the PropertyChanged event for the name of the property that you've changed, not for the Data property.

I hope this helps.

Regards,
Deyan
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Matt
Top achievements
Rank 1
answered on 21 Nov 2014, 09:53 PM
I'm having this same issue.
This only happens with bindings that user converters, any ideas?
0
Tsvyatko
Telerik team
answered on 24 Nov 2014, 07:18 AM
Hello Matt,

Please verify that your business object implement INotifyPropertyChanged and that the converter does not throw exception (as the latter will not stop the execution of the program).

 If this is not the case could you send us more information (code snippets or project) describing the scenario and the issue you are having?

Regards,
Tsvyatko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
DataBoundListBox
Asked by
Jagoba
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Matt
Top achievements
Rank 1
Tsvyatko
Telerik team
Share this question
or