我正在尝试向表中添加一个新项目,但是下面的代码抛出了 InvalidCastException。
这是从添加项目页面将新项目添加到我的表中。WineDate 来自 DatePicker,WineStars 来自 ListPicker,Category 来自链接到表格的 listpicker
WineItem newWineItem = new WineItem
{
WineDate = wineDatepurchasedTextbox.Value.Value.Date,
WineComments = wineCommentsTextBox.Text,
WineStars = (string)StarList.SelectedItem,
WineType = wineTypeTextbox.Text,
WineVinyard = wineVineyardTextbox.Text,
WineYear = wineYearTextbox.Text,
Category = (WineCategory)winecategoriesListPicker.SelectedItem
};
如果您需要任何进一步的信息来帮助我,请告诉我。