wpf combox自动刷新

类继承INotifyPropertyChanged接口,然后把List的类型改为ObservableCollection

如下

        private ObservableCollection<string> reagentNameList = new ObservableCollection<string>();
        /// <summary>
        /// 配方
        /// </summary>
        public ObservableCollection<string> ReagentNameList
        {
            get 
            {
                GetAllReagent();
                return reagentNameList; 
            }
            set { reagentNameList = value; OnPropertyChanged(); }
        }

 

posted @ 2024-09-29 15:30  echo-efun  阅读(51)  评论(0)    收藏  举报