forum

Home / DeveloperSection / Forums / how can i access the textbox inside the datagrid using the events of that datagrid?

how can i access the textbox inside the datagrid using the events of that datagrid?

Jayden Bell 4525 03-Sep-2013

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.....................

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

wpf wpf 
Updated on 03-Sep-2013

Can you answer this question?


Answer

1 Answers

Liked By