UI is not updated when the collection changes.

Class code

public static class Contractors { static ObservableCollection<Contractor> ContractorsList; public static ObservableCollection<Contractor> CONTRACTORS { get { return ContractorsList; } } } 

Xaml code

 <telerik:RadGridView x:Name="contractorsTable" Grid.Row="1" AutoGenerateColumns="False" FontSize="12px" IsReadOnly="True" ShowSearchPanel="True" SelectionMode="Extended" MouseDoubleClick="ContractorsTable_OnMouseDoubleClick" ItemsSource="{Binding Source={x:Static zaDelo:Contractors.CONTRACTORS}}" > <telerik:RadGridView.Columns> <telerik:GridViewDataColumn DataMemberBinding="{Binding IdContractors}" Header="Код" Width="45" ShowDistinctFilters="False" IsFilterable="False"/> <telerik:GridViewDataColumn DataMemberBinding="{Binding Iname}" Header="Наименование" Width="2*" IsFilterable="False"/> <telerik:GridViewDataColumn DataMemberBinding="{Binding BidPrice}" Header="Цена" Width="45" IsFilterable="False"/> <telerik:GridViewDataColumn DataMemberBinding="{Binding Phone}" Header="Телефон" IsFilterable="False" Width="*" IsSortable="False"/> <telerik:GridViewDataColumn DataMemberBinding="{Binding Email}" Header="Email" IsFilterable="False" IsSortable="False" /> <telerik:GridViewDataColumn DataMemberBinding="{Binding UserName}" Header="ОТВ" Width="50" TextAlignment="Center" IsFilterable="False"/> <telerik:GridViewDataColumn DataMemberBinding="{Binding City}" Header="Город" Width="60" IsFilterable="False"/> <telerik:GridViewDataColumn DataMemberBinding="{Binding Region}" Header="Район" Width="60" IsFilterable="False"/> <telerik:GridViewDataColumn DataMemberBinding="{Binding Loyalty}" Header="Лояльность" Width="60" IsFilterable="False"/> <telerik:GridViewDataColumn Header="" CellStyleSelector="{StaticResource ClientBonusS}" Width="15"/> <telerik:GridViewDataColumn DataMemberBinding="{Binding IdCart}" Header="Карта" Width="45" TextAlignment="Center" IsFilterable="False"/> <telerik:GridViewDataColumn DataMemberBinding="{Binding ContractorGroup}" Header="Назначение" Width="*" IsFilterable="False"/> </telerik:RadGridView.Columns> </telerik:RadGridView> 

Please tell me how to associate updates in the UI together with changes in the collection.

  • Are you changing the collection or object in the collection? - RusArt
  • Yes, the static collection itself is updated either by a method call or by a timer in the streams, because several people can work with the base. - Sergey

1 answer 1

ObservableCollection notifies of the change of the collection itself (add, delete, etc.). If you want to see an item change in the collection, then the item itself must implement the INotifyPropertyChanged interface. I.e:

 public class Contractor : INotifyPropertyChanged { ... } 
  • Thanks for the decision! - Sergey