# Other .NET Programming > Windows Presentation Foundation (WPF) & XAML forum >  WPF Binding Problem with ObservableCollection

## EagleSparrow

I am having a problem binding a log file to a WPF list control.
My list is ObservableCollection<string>

My data changes through an even under the hood. My list should change in the window. I do not see changes. As my hardware issues events the data is updating the log file but the view is not updating.

   [Serializable]
    public class MeterLog : NotificationObject
    {
        private static MeterLog instance;
        public static MeterLog Instance 
        {
            get 
            {
                if(instance == null)
                    instance = new MeterLog();
                return instance;
            }
        }

        private MeterLog()
        {
            Title = "Debug Log\n";
            Add(string.Format("Log Timesttamp:{0}", DateTime.Now.ToShortTimeString()));
        }

        public string Title { get; set; }
        private ObservableCollection<string> log = new ObservableCollection<string>();

        public ObservableCollection<string> Log
        {
            get { return log; }
            private set { log = value;  this.RaisePropertyChanged("Log"); }
        }

        public void Add(string msg)
        {
            log.Add(msg);
        }

        public void WriteXMLFile()
        {
            MeterLog log = MeterLog.instance;

            System.Xml.Serialization.XmlSerializer writer = 
                new System.Xml.Serialization.XmlSerializer(typeof(MeterLog));

            log.Title = "This is the Allication Error Log";

            System.IO.StreamWriter file = new System.IO.StreamWriter(
               AppDomain.CurrentDomain.BaseDirectory +"\\ApplicationLog.xml");

            writer.Serialize(file, log);
            file.Close();
        }
    }


VIEW MODEL
 public  ObservableCollection<string> ErrorLog
        {
               get 
                {
                     return myHardware.Log;
                }
        }

My XAML is here

 <Window.DataContext>
        <vm:ViewModelOne />
</Window.DataContext>

   <ListBox Margin="10,10,10,375" x:Name="lvErrors"  ItemsSource="{Binding ErrorLog}"  HorizontalAlignment="Stretch" Grid.Row="2" />

----------


## kannans1984

You need to raise the property changed event for "ErrorLog" whenever the myHardware.Log gets updated.,

----------

