搜索数据网格WPF中的文本框(datatemplate) [英] Search the textbox(datatemplate) in the data grid WPF

查看:76
本文介绍了搜索数据网格WPF中的文本框(datatemplate)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友

我在Datagrid中使用过DataTemplate TextBox。现在我想搜索文本框。

数据网格填充数据表。

Hi friends
I've used the DataTemplate TextBox in Datagrid. And now I want to search the textbox.
The data grid is filled with datatable.

dataGrid1.ItemsSource = tbl.DefaultView;





Xaml代码:


and
Xaml code:

<DataGrid  AutoGenerateColumns="False" ColumnWidth="100"  GridLinesVisibility="All"   Height="200" HorizontalAlignment="Left"  Name="dataGrid1"   SelectionMode="Single" >
          <DataGrid.Columns>
            <DataGridTextColumn Binding="{Binding Row}" Header="Row " />
            <DataGridTemplateColumn Header="Title" Width="150" MinWidth="100" MaxWidth="100" >
                <DataGridTemplateColumn.CellTemplate>
                    <DataTemplate>
                        <TextBox Text="{Binding fldTitle}" Name="txttitle" />
                    </DataTemplate>
                </DataGridTemplateColumn.CellTemplate>
            </DataGridTemplateColumn>

        </DataGrid.Columns>
    </DataGrid>



我需要清空第一行,可以输入在查询下的第一行和列中,并在相关行中键入每个字符。

现在有两个问题:

如何首先在行中创建一个空行(datagrid)?

如何进行搜索?

谢谢



我尝试过:




I need to empty the first row, which can be entered in the first row and in the column under the query, and by typing each character in the related rows.
Now two questions:
How to create an empty row in line first (datagrid)?
How to do the search?
thank you

What I have tried:

<DataGrid  AutoGenerateColumns="False" ColumnWidth="100"  GridLinesVisibility="All"   Height="200" HorizontalAlignment="Left"  Name="dataGrid1"   SelectionMode="Single" >
          <DataGrid.Columns>
            <DataGridTextColumn Binding="{Binding Row}" Header="Row " />
            <DataGridTemplateColumn Header="Title" Width="150" MinWidth="100" MaxWidth="100" >
                <DataGridTemplateColumn.CellTemplate>
                    <DataTemplate>
                        <TextBox Text="{Binding fldTitle}" Name="txttitle" />
                    </DataTemplate>
                </DataGridTemplateColumn.CellTemplate>
            </DataGridTemplateColumn>

        </DataGrid.Columns>
    </DataGrid>

推荐答案

您是否尝试过Google搜索? Google搜索是您的朋友: wpf datagrid搜索行 - Google搜索 [ ^ ]



发现:

* wpf - 带过滤器行的数据网格 - 堆栈溢出 [ ^ ] - 两个解决方案,这两个都是CodeProject上的文章:

1. 自动WPF工具包DataGrid过滤 [ ^ ]

2. Microsoft WPF DataGrid的自动过滤器 [ ^ ]
Did you try Google Search? Google Search is your friend: wpf datagrid search row - Google Search[^]

Found this:
* wpf - Datagrid with filter row - Stack Overflow[^] - has two solutions, both of which are articles right here on CodeProject:
1. Automatic WPF Toolkit DataGrid Filtering[^]
2. Auto-filter for Microsoft WPF DataGrid[^]


这篇关于搜索数据网格WPF中的文本框(datatemplate)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆