Age*_*ire 1 data-binding wpf templates listbox observablecollection
我有这个系列
ObservableCollection<string> Urls { get; set; }
Run Code Online (Sandbox Code Playgroud)
在我的数据上下文类中.我在列表框中绑定了它:
<ListBox ItemsSource="{Binding Urls}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBox Text="{Binding .}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Run Code Online (Sandbox Code Playgroud)
数据显示在列表框中,两个相应的 - 未显示 - 这里的按钮带有命令Add和Delete也可以工作,但是,更改TextBox不会影响集合的内容.
我试过Mode=TwoWay绑定,但我认为它已经打开了.我已经尝试了一些其他选项,如Validate = OnPropertyChange,但是,仍然没有任何更新.
如何使实际TextBox模板中的内部ListBox实际更新Urlsdatacontext类的属性?
| 归档时间: |
|
| 查看次数: |
1078 次 |
| 最近记录: |