在DataGrid WPF中设置AutocompletBox [英] Set AutocompletBox inside DataGrid wpf

查看:82
本文介绍了在DataGrid WPF中设置AutocompletBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在datagrid的某一列内设置一个AutocompletBox,然后在我要调用更改该文本的方法之后,这将更改该特定行的其他列的数据.

我尝试了几种方法,但是每次有新的异常出现时,
有人做过这种工作吗?


感谢advane

I want to set a AutocompletBox inside one of the column of the datagrid, and there after I want to call a method on changing of that text, this will change the data of other columns of that particular row.

I have tried several ways but everytime a new exception is coming,
Is anybody did this type of work?


Thanks in advane

推荐答案

以下是我自己的问题的解决方案,您可以尝试以下

Below is the solution of my own question you can try this

<DataGrid Height="100" HorizontalAlignment="Left" Margin="12,0,0,0" Name="dataGrid2" VerticalAlignment="Top" Width="479" ItemsSource="{Binding}" TextInput="dataGrid1_TextInput" AutoGenerateColumns="False" Grid.Row="3" >
    <DataGrid.Columns>
        <DataGridTemplateColumn Header="Country" Width="100"  >
            <DataGridTemplateColumn.CellTemplate>
                <DataTemplate>
                    <toolkit2:AutoCompleteBox  Name="autoComplete"  Width="300" Height="30" Margin="0" ItemsSource="{Binding lstStrState}" SelectionChanged="autoComplete_SelectionChanged"></toolkit2:AutoCompleteBox>
                </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
        </DataGridTemplateColumn>
    </DataGrid.Columns>
</DataGrid>


这篇关于在DataGrid WPF中设置AutocompletBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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