如何使用该datagrid的事件访问datagrid中的文本框? [英] how can i access the textbox inside the datagrid using the events of that datagrid?

查看:75
本文介绍了如何使用该datagrid的事件访问datagrid中的文本框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据网格中有一个使用xaml设计的文本框。我是否可以使用datagrid的事件访问先前在codefile中使用xaml设计的文本框。请帮帮我.....................

I have a textbox in a datagrid that is designed using xaml. Can I access the textbox which has been designed in xaml previously in codefile using the events of the datagrid. Please help me.....................

<br />
<Window x:Class="GridTextBox.Test"<br />
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"<br />
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" WindowState="Maximized"<br />
    Title="Test" Height="300" Width="300" Loaded="Window_Loaded"><br />
<Grid><br />
    <Grid.RowDefinitions><br />
        <RowDefinition Height="30"/><br />
        <RowDefinition Height="*"/><br />
        <RowDefinition Height="30"/><br />
    </Grid.RowDefinitions><br />
    <Grid.ColumnDefinitions><br />
        <ColumnDefinition Width=".25*"/><br />
<br />
        <ColumnDefinition Width=".25*"/><br />
        <ColumnDefinition Width=".25*"/><br />
        <ColumnDefinition Width=".25*"/><br />
    </Grid.ColumnDefinitions><br />
    <DataGrid Grid.Row="1" Grid.Column="1"  Name="datagrid1" SelectionChanged="datagrid1_SelectionChanged" LoadingRowDetails="DataGrid_LoadingRowDetails"  Height="auto" Width="auto"><br />
        <DataGrid.Columns><br />
            <DataGridTemplateColumn><br />
                <DataGridTemplateColumn.CellTemplate><br />
                    <DataTemplate><br />
                        <TextBox Name="txtEmpid" Text="hiiiiii"></TextBox><br />
                    </DataTemplate><br />
                </DataGridTemplateColumn.CellTemplate><br />
            </DataGridTemplateColumn><br />
        </DataGrid.Columns><br />
    </DataGrid><br />
</Grid><br />

推荐答案

请检查一下......

http://www.c-sharpcorner.com/UploadFile/8911c4/how-to-find- control-and-value-form-datagrid-in-wpf / [ ^ ]



这里有两个DataGridTemplateColumns并在一个datatemplate中访问另一个控件...
Please check this...
http://www.c-sharpcorner.com/UploadFile/8911c4/how-to-find-control-and-its-value-form-datagrid-in-wpf/[^]

Here there are two DataGridTemplateColumns and accessing a control within one datatemplate from another...


这篇关于如何使用该datagrid的事件访问datagrid中的文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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