本文介绍了我想在列中使用带有列表框的Listview。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在为应用程序编写排序/过滤器控件。我想要的是使用列表视图来显示过滤器,并能够添加和删除过滤器中的行。我还是WPF的新手,所以我可以相信我犯了一些明显的错误,或者错过了其他一些简单的错误。 我的listview,因为我现在有它在XAML中 < ListView Horizo​​ntalAlignment =StretchMargin =5Name =lvFilterVerticalAlignment =Stretch> < ListView.View> < GridView> < GridViewColumn Header =ColumnWidth =220> < GridViewColumn.CellTemplate> < DataTemplate> < ListBox Name =lbColumnListItemsSource ={Binding Path = Name,Source = {StaticResource AvailableColumns}}/> < / DataTemplate> < /GridViewColumn.CellTemplate> < / GridViewColumn> < GridViewColumn Header =OperationWidth =130> < GridViewColumn.CellTemplate> < DataTemplate> < ListBox Name =lbOperationItemsSource ={Binding Path = Value,Source = {StaticResource AvailableOperations}}/> < / DataTemplate> < /GridViewColumn.CellTemplate> < / GridViewColumn> < GridViewColumn Header =ValueWidth =250> < GridViewColumn.CellTemplate> < DataTemplate> < TextBox Name =txtValue>< / TextBox> < / DataTemplate> < /GridViewColumn.CellTemplate> < / GridViewColumn> < / GridView> < /ListView.View> < / ListView> 我希望有2个下拉菜单和一个文本框。每个列表框都将绑定到有效列表。在查看已保存的过滤器时,每个AND将在列中包含操作和值的行。成本> 1000. 我遗漏了一些关于如何在这个级别使用ListView的关键信息,我还没有找到任何关闭的例子。没有人有如何在模板中使用绑定列表框的示例。 任何帮助或示例都将非常感激。解决方案 I am writing a sort/filter control for an application. What I would like is to use a list view to display the filter and to be able to add and remove lines from the filter. I'm still fairly new to WPF so I can believe I've made some obvious mistakes or missed something else that is simple.my listview as I currently have it in XAML<ListView HorizontalAlignment="Stretch" Margin="5" Name="lvFilter" VerticalAlignment="Stretch"> <ListView.View> <GridView> <GridViewColumn Header="Column" Width="220"> <GridViewColumn.CellTemplate> <DataTemplate> <ListBox Name="lbColumnList" ItemsSource="{Binding Path=Name, Source={StaticResource AvailableColumns}}"/> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> <GridViewColumn Header="Operation" Width="130"> <GridViewColumn.CellTemplate> <DataTemplate> <ListBox Name="lbOperation" ItemsSource="{Binding Path=Value, Source={StaticResource AvailableOperations}}"/> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> <GridViewColumn Header="Value" Width="250"> <GridViewColumn.CellTemplate> <DataTemplate> <TextBox Name="txtValue"></TextBox> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> </GridView> </ListView.View></ListView>I'm looking to have 2 dropdowns and a textbox. Each of the listboxes will be bound to a valid list. When looking at a saved filter each 'AND' will have a line with the column the operation and the value ie. COST > 1000.I'm missing some critical information on how to use the ListView at this level and I haven't found any examples even close. No one has an example of how to use a bound listbox in the template.Any help or examples would be much appreciated. 解决方案 这篇关于我想在列中使用带有列表框的Listview。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-06 00:51