繁体   English   中英

在Windows Phone 7应用程序中的日历中选择日期时出现NotSupportedException异常

[英]Getting NotSupportedException exception on date selection in calendar in windows phone 7 application

我正在做Windows Phone 7应用程序,它使用名称空间System.Windows.Controls的日历控件。 我的日历控件位于同一名称空间的TabControl内部。

当我选择一个日期时,出现以下“ NotSupportedException”消息:

“这种类型的Collection不支持从与Dispatcher线程不同的线程对其SourceCollection进行更改。”

发生此类错误的原因可能是什么,我是否可以解决此问题? 在此处输入图片说明

异常详细信息:未处理System.NotSupportedException Message =此Collection类型不支持从与Dispatcher线程不同的线程对其SourceCollection进行更改。 StackTrace:位于System.Windows.Controls.SelectedDatesCollection.InsertItem(Int32索引,DateTime项目)在System.Collections.ObjectModel.Collection`1.Add(DateTime项目)在System.Windows.Controls.SelectedDatesCollection.AddRange(DateTime开始,DateTime结束)在System.Windows.Controls.Primitives.CalendarItem.Cell_MouseLeftButtonUp(对象发件人,MouseButtonEventArgs e)在System.Windows.Controls.Primitives.CalendarDayButton.OnMouseLeftButtonUp(CalendarDayButton b) System.Windows.Controls.Control.OnMouseLeftButtonUp上的MouseButtonEventArgs e)(MS.Internal.JoltHelper.FireEvent上的Control ctrl,EventArgs e)

更改此日期会发生什么事? 我的意思是有什么事情可以处理吗? 似乎您正在尝试从UI线程以外的其他线程更改列表(也许是列表框的数据源?)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM