1\u3001\u4e3e\u4f8b1\uff1a<\/strong><\/span><\/div>\nMainWindow.xaml\uff1a<\/p>\n
xaml\u9875\u9762\u5f88\u7b80\u5355\uff0c\u62582\u4e2alistbox\u5206\u522b\u7528\u6765\u7ed1\u5b9aObservableCollection\u548cList
\nPerson.cs\uff1a<\/p>\n
public class Person \r\n { \r\n public string Name { get; set; } \r\n } \r\n<\/pre>\nMainWindow.xaml.cs\uff1a<\/p>\n
private List person1 = new List(); \r\nprivate ObservableCollection person2 = new ObservableCollection(); \r\npublic DemoTestDiff() \r\n{ \r\nInitializeComponent(); \r\nperson1.Add(new Person() { Name = \"\u5f20\u4e09\" }); \r\nperson1.Add(new Person() { Name = \"\u674e\u56db\" }); \r\nlistbind.ItemsSource = person1; \r\nperson2.Add(new Person() { Name = \"\u5f20\u4e09\" }); \r\nperson2.Add(new Person() { Name = \"\u674e\u56db\" }); \r\nobservbind.ItemsSource = person2; \r\n} \r\nprivate void button1_Click(object sender, RoutedEventArgs e) \r\n{ \r\nperson1.Add(new Person() { Name = \"\u738b\u4e94\" }); \r\nperson2.Add(new Person() { Name = \"\u738b\u4e94\" }); \r\n} \r\n<\/pre>\n\u8fd0\u884c\u7a0b\u5e8f\u70b9\u51fbbutton\u6309\u94ae,\u7136\u540e\u53ea\u6709ObservableCollection\u7684\u6709\u6dfb\u52a0\u3002
\n\u8868\u793a\u5f53\u96c6\u5408\u5bf9\u8c61\u7684\u96c6\u5408\u6539\u53d8\u65f6\uff0c\u53ea\u6709ObservableCollection\u4f1a\u53d1\u51fa\u901a\u77e5\u66f4\u65b0UI\u3002<\/p>\n
\u8fd9\u53ea\u662f\u4ed6\u4eec\u4e24\u4e2a\u533a\u522b\u4e4b\u4e00\u3002<\/p>\n
2\u3001\u4e3e\u4f8b2<\/strong><\/span><\/div>\n\u4ee5\u4e0b\u65b9\u6cd5\u53ef\u4ee5\u66f4\u65b0ListView\u7684UI\uff1a<\/p>\n
\r\nprivate ObservableCollection<PreviewListModel> _previewList = new ObservableCollection<PreviewListModel>();\r\n\/\/\/ <summary>\r\n\/\/\/ \u9884\u89c8\u4fe1\u606f\u5217\u8868\r\n\/\/\/ <\/summary>\r\npublic ObservableCollection<PreviewListModel> PreviewList\r\n{\r\nget { return _previewList; }\r\nset { SetProperty(ref _previewList, value); }\r\n\/\/set { _previewList = value; RaisePropertyChanged(\"PreviewList\"); }\r\n}\r\n<\/pre>\n\u4e09\u3001 ObservableCollection\u548cList\u7684\u4e92\u76f8\u8f6c\u6362<\/strong><\/div>\n\u4ece\u6570\u636e\u5e93\u68c0\u7d22\u7684\u51fa\u6765\u7684\u96c6\u5408\u662fList\u7c7b\u578b\uff0c\u6211\u4eec\u9700\u8981\u628a\u5b83\u8f6c\u6210ObservableCollection\u7c7b\u578b\u600e\u4e48\u529e?\u5982\u4e0b\u65b9\u6cd5\uff1a<\/p>\n
T tList = new List(tObjectStruct .ToList()); \r\nObservableCollection tObjectStruct = new \r\n<\/pre>\n\u6570\u636e\u5e93\u68c0\u7d22\uff1a<\/p>\n
\r\npublic void AdvancedSearchFunc(AdvancedSearchNotification advancedSearchNotification)\r\n{\r\ntry\r\n{\r\nKrayMobileDREntities dataBase = new KrayMobileDREntities();\r\n\/\/\u6bcf\u6b21\u4f7f\u7528\u524d\u5fc5\u987b\u6e05\u96f6\r\npatientInfoHistroryModel.Clear();\r\n\/\/\u5148\u628a\u6570\u636e\u5e93\u7684\u6570\u636e\u63d0\u53d6\u51fa\u6765\uff0c\u653e\u5230\u96c6\u5408\u4e2d\u3002\r\nList<PatientInfo_Table> patientInfoList =\r\ndataBase.PatientInfo_Table.Where(u => u.PatientKey.ToString().Equals(advancedSearchNotification.PatientInfo)\r\n|| u.PatientID.ToString().Equals(advancedSearchNotification.StudyID)\r\n|| u.PatientName.ToString().Equals(advancedSearchNotification.PatientName)\r\n).ToList();\r\nList<PatientStudy_Table> patientStudyList = dataBase.PatientStudy_Table.Where(u => u.PatientKey < 10).ToList();\r\n\/\/\u6309\u6761\u4ef6\u68c0\u7d22\u96c6\u5408\r\nList<PatientInfoHistroryModel> list =\r\n(from pI in patientInfoList\r\nwhere (pI.PatientKey < 1000)\r\nselect new PatientInfoHistroryModel()\r\n{\r\nPatientInfo = pI.PatientKey.ToString(),\r\nStudyID = pI.PatientID.ToString(),\r\nPatientName = pI.PatientName.ToString(),\r\nPatientSex = pI.PatientSex.ToString(),\r\nPatientAge = pI.PatientAge.ToString(),\r\nPatientBrith = pI.PatientBirthDate.ToString(),\r\nPatientHeight = pI.PatientHeight.ToString(),\r\nPatientWeight = pI.PatientWeight.ToString(),\r\nRecordSource = pI.PatientSource.ToString(),\r\n\/\/StudyTime = PS.StudyDatetime,\r\n\/\/EquipmentType = PS.StudyPhysician,\r\n\/\/StudyPart = PS.StudyType,\r\n\/\/SequenceAmount = PS.SeriesCount,\r\nStudyTime = pI.PatientAge.ToString(),\r\nEquipmentType = pI.PatientAge.ToString(),\r\nStudyPart = pI.HangFlag.ToString(),\r\nSequenceAmount = pI.HangFlag.ToString(),\r\nStudyStutas = pI.StudyCompleteFlag.ToString(),\r\nSuspendState = pI.HangFlag.ToString(),\r\nFilmPrint = pI.PrintFlag.ToString(),\r\n}).ToList();\r\npatientInfoHistroryModel = list;\r\ndataBase.Dispose();\r\n}\r\ncatch (Exception ex)\r\n{\r\nMessageBox.Show(\"\u75c5\u4eba\u5386\u53f2\u8bb0\u5f55\u4fe1\u606f\u8868\u3010\u9ad8\u7ea7\u67e5\u8be2\u3011\u72b6\u6001\u4e0b,\u53d1\u751f\u6570\u636e\u5e93\u9519\u8bef\u3002\u9519\u8bef\u4fe1\u606f:--------------\" + ex.ToString());\r\nLogHelper.Error(\"OperateDataSheetViewModel.cs::AdvancedSearchFunc()\u9ad8\u7ea7\u67e5\u8be2\u5931\u8d25--\" + ex.Message);\r\n}\r\n}\r\n<\/pre>\n\u56db\u3001\u603b\u7ed3<\/strong><\/div>\n1\u3001ObservableCollection\u8868\u793a\u4e00\u4e2a\u52a8\u6001\u6570\u636e\u96c6\u5408\uff0c\u5728\u6dfb\u52a0\u9879\u3001\u79fb\u9664\u9879\u6216\u5237\u65b0\u6574\u4e2a\u5217\u8868\u65f6\uff0c\u6b64\u96c6\u5408\u5c06\u63d0\u4f9b\u901a\u77e5\u3002
\n2\u3001List\u8868\u793a\u53ef\u901a\u8fc7\u7d22\u5f15\u8bbf\u95ee\u7684\u5bf9\u8c61\u7684\u5f3a\u7c7b\u578b\u5217\u8868\u3002\u63d0\u4f9b\u7528\u4e8e\u5bf9\u5217\u8868\u8fdb\u884c\u641c\u7d22\u3001\u6392\u5e8f\u548c\u64cd\u4f5c\u7684\u65b9\u6cd5\u3002(\u5927\u90e8\u5206\u64cd\u4f5c\u7528Linq\uff0c\u5f88\u5f3a\u5927\u4e5f\u5f88\u65b9\u4fbf\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
Collection\uff1a\u4e3a\u6cdb\u578b\u96c6\u5408\u63d0\u4f9b\u57fa\u7c7b\u3002 INotifyCollectionChanged\uff1a\u5c06\u96c6\u5408\u7684\u52a8\u6001\u66f4\u6539 […]<\/p>\n","protected":false},"author":1898,"featured_media":210878,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[651],"class_list":["post-210872","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread","tag-c-observablecollectionlist"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/210872","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1898"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=210872"}],"version-history":[{"count":13,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/210872\/revisions"}],"predecessor-version":[{"id":211165,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/210872\/revisions\/211165"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/210878"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=210872"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=210872"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=210872"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}