Динамическое обновление привязки listbox

XAML

       <ListBox Background="Transparent" ScrollViewer.HorizontalScrollBarVisibility="Disabled"  
        BorderThickness="0" RenderTransformOrigin="0.5,0.5" SelectedItem="{Binding SelectedArticle}" ItemsSource="{Binding articles_list}" Margin="9,5.2,-0.2,0" Grid.Row="3" VerticalAlignment="Top" Height="273" Grid.ColumnSpan="2" HorizontalAlignment="Left" Width="696"  >
        <ListBox.ItemContainerStyle>
            <Style TargetType="{x:Type ListBoxItem}">
                <Setter Property="Background" Value="Transparent" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ListBoxItem}">
                            <ContentPresenter />
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </ListBox.ItemContainerStyle>
        <ListBox.ItemTemplate>
            <DataTemplate>
                            <TextBlock FontSize="15" TextWrapping="Wrap" Style="{StaticResource Font}"  Opacity="1" Text="{Binding Name}" Foreground="White" Height="51" Width="237" Canvas.Top="42" RenderTransformOrigin="0.5,0.5" Canvas.Left="50"/>                                                  
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>

VIEWMODEL(GetEducationNews команда кнопки)

   public static ObservableCollection<NewArticles> articles = new ObservableCollection<NewArticles>();
    public static ObservableCollection<NewArticles> articles_list { get; set; }
    public void GetEducationNews()
    {
        articles.Clear();
        currentsize = 0;
        articles = db.GetArticlesByCategory("Education");
        GetNextImage();

    }

MODEL

   public class NewArticles : INotifyPropertyChanged
    {
    private string name;
    public NewArticles() { }
   
    public string Name
    {
        get {
            /*return UrlList[NameList.Count-1-currentName];*/
            return name;
        }
        set
        {
            name = value;
            OnPropertyChanged("Name");
        }
    }
   

    public event PropertyChangedEventHandler PropertyChanged;
    public void OnPropertyChanged([CallerMemberName] string prop = "")
    {
        if (PropertyChanged != null)
            PropertyChanged(this, new PropertyChangedEventArgs(prop));
    }

   
}

Привязка срабатывает только если я инициализирую коллекцию в конструкторе VIEWMODEL при первой загрузке


Ответы (0 шт):