在WPF多列列表框 [英] Multicolumn ListBox in WPF
问题描述
我有3个文本框和1键,想进入与多列列表框中的文本框的信息。这样将保存在列表框中的电话目录
I have 3 textboxes and 1 button and want to enter the textboxes information in the listbox with multicolumn. like a phone directory that will be saved in the listbox
我知道如何与一列使其 listbox1.Items.Add(TextBox1.text)
。我怎样才能在未来的列添加其他的文本框?我使用.NET WPF
I know how to make it with one column listbox1.Items.Add(TextBox1.text)
. How can I add the others textboxes in the next columns? i am using .net WPF
我想用一个列表框或一个ListView,但我现在不如何在列表视图或列表框
i want to use a listbox or a listview but i dont now how to enter the information of the text boxes in the listview or listbox
见链接 http://i.stack.imgur.com/FtQ47.png
推荐答案
您需要一个<一个href="http://msdn.microsoft.com/en-us/library/system.windows.controls.listview.aspx"><$c$c>ListView$c$c>代替。
You want a ListView
instead.
事情是这样的:
<ListView ItemsSource="{Binding SourceCollection}">
<ListView.View>
<GridView>
<GridViewColumn Header="Test1" DisplayMemberBinding="{Binding Test1}" />
<GridViewColumn Header="Test2" DisplayMemberBinding="{Binding Test2}" />
<GridViewColumn Header="Test3" DisplayMemberBinding="{Binding Test3}" />
<GridViewColumn Header="Button">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Button>Button Text</Button>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
这篇关于在WPF多列列表框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!