【发布时间】:2012-05-05 10:36:48
【问题描述】:
我在将 TextBox 绑定到字符串时遇到问题(StringBuilder 也有同样的问题)。
这里是 xaml:
<ListBox x:Name="MyList" ItemsSource="{Binding ListOfBullets, Mode=TwoWay, Converter=StaticResourcedebugConverter}}">
<ListBox.ItemTemplate>
<DataTemplate>
<local:TaskStepControl Text="{Binding Mode=TwoWay}" AddHnadler="{Binding DelegateForHandlingAddTaskStep, ElementName=uc}"></local:TaskStepControl>
</DataTemplate>
</ListBox.ItemTemplate>
ListBox 的 Items 是:
public ObservableCollection<StringBuilder> ListOfBullets{get{....} set{....}}
我也试过了:
public ObservableCollection<string> ListOfBullets{get{....} set{....}}
如果我运行该应用程序,我会收到一个未停止的异常“参数不正确。” 如果我删除 Mode=TwoWay 那么它可以工作,但正如预期的那样,编辑文本框不会更改 ListOfBullets 中的文本绑定对象;
我做错了什么?
【问题讨论】:
标签: windows-phone-7 xaml listbox