This is a migrated thread and some comments may be shown as answers.

Accessing gridviewrow entity in DataTemplate TextBox LostFocus Event

2 Answers 29 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rama
Top achievements
Rank 1
Rama asked on 28 Sep 2012, 06:46 AM
Hi

I have gridview bind to List<Employee> in WPF and i have datatemplate with textbox inside gridviewrow.

-- Textbox has LostFocus Event.

-- How to access Employee entity attached to gridviewrow in LostFocus Event Handler in code behind.

-- Please provide a small code snippet for that.

Thank You.
Rama

2 Answers, 1 is accepted

Sort by
0
Rama
Top achievements
Rank 1
answered on 04 Oct 2012, 07:55 PM
hey

it is very simple.

I figure it out by following way :

Person p = (Person)((TextBox)sender).DataContext ;


Thanks
Rama
0
Gautam
Top achievements
Rank 1
answered on 20 Aug 2018, 12:50 PM

  <ItemsControl   Panel.ZIndex="0">
              <ItemsControl.ItemTemplate>
                       <DataTemplate>
                                <Canvas LostFocus="Canvas_LostFocus" 

 

"Canvas_LostFocus" is not working

 

Tags
GridView
Asked by
Rama
Top achievements
Rank 1
Answers by
Rama
Top achievements
Rank 1
Gautam
Top achievements
Rank 1
Share this question
or