Control does not get refreshed when ItemSource binding changes

4 posts, 0 answers
  1. Jagoba
    Jagoba avatar
    4 posts
    Member since:
    Apr 2013

    Posted 10 Sep 2013 Link to this post

    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.
  2. Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 11 Sep 2013 Link to this post

    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.
  3. DevCraft banner
  4. Matt
    Matt avatar
    1 posts
    Member since:
    Aug 2012

    Posted 21 Nov 2014 Link to this post

    I'm having this same issue.
    This only happens with bindings that user converters, any ideas?
  5. Tsvyatko
    Admin
    Tsvyatko avatar
    833 posts

    Posted 24 Nov 2014 Link to this post

    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.

     
Back to Top
DevCraft banner