TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
zerak
NA
1
0
How to reference indevedual controls in wpf DataGrid Visual Studio 2010
Feb 2 2010 7:24 PM
I am using Visual Studio 2010 beta 2. I created a WPF application that has a DataGrid. I am able to bind the DataGrid to a DataTable. The DataGrid has one column that is a DataGridTemplateColumn contains a TextBox control.
<DataGrid.Columns>
<DataGridTemplateColumn ClipboardContentBinding="{x:Null}" Header="Notes" CanUserReorder="False" CanUserResize="True" CanUserSort="True" Width="210">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Notes}" Padding="5,5,5,5" Width="200" Height="100" AcceptsReturn="True" AcceptsTab="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Visible"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
I have a "Save" button that once it is clicked, I need to get what the user typed in the TextBox. Is there a way I can loop through the DataGrid and access each Row, Cell control? For example, TextBox tx = (TextBox)DataGrid1.Rows[0][0].
Your help will be greatly appreciated
Reply
Answers (
1
)
How to Get data from grid into textboxes in WPF with C#?
I want to bind an XML document to a ListBox and access it using XDocument NOT XMLDocument