public DialogAlarmViewModel( ICollectionModel <eventwarn> dataModel) //List<eventwarn> alarms) { this._dataModel = dataModel; //this.Alarms = (ListCollectionView)new ListCollectionView((IList)alarms); this.Alarms = (ListCollectionView) new ListCollectionView((IList)_dataModel.Data); using (Alarms.DeferRefresh()) { Alarms.Filter = delegate(object obj) { eventwarn alarm = obj as eventwarn; if (alarm != null && (!alarm.handlestatus.HasValue || alarm.handlestatus == 0) && alarm.action == "trig") { return(true); } return(false); }; Alarms.SortDescriptions.Add(new SortDescription("time", ListSortDirection.Descending)); } }