【发布时间】:2012-11-07 10:22:02
【问题描述】:
我知道:
String test = "test";
ListBox.Items.Add(test);
或
String test = "test";
int index = 1;
ListBox.Items.Insert(index, String);
在ListBox中添加String,但我想插入ListBoxItem,怎么做? 以前我知道
var contentToString = (String)ListBoxItem.Content;
只是将 ListBoxItem 转换为 String,但我不能做相反的事情将 String 转换为 ListBoxItem
【问题讨论】:
-
这是asp.net还是winforms?
-
@DaniloVulović:ASP.NET ListBox 没有内容属性。
-
winforms中没有ListBoxItem!
-
具体来说,我正在编写一个 Windows 8 Metro 应用程序。我使用 C# 和 XAML。
标签: c# wpf string listbox listboxitem