I would like to get the column name of the cell the same way i did with its content on my loose focus method.I can get the content but not the column header.
private void lostFocus(object sender, RoutedEventArgs e)
{
var jj = sender as DataGridColumnHeader;
var box = sender as TextBox;
if (box != null && box.Text != "0")
{
var ff = jj.Column.Header.ToString();
if (ff == "column1") { amount1 = Int32.Parse(box.Text); }
if (ff == "column2") { amount2 = Int32.Parse(box.Text); }
if (ff == "column3") {amount3 = Int32.Parse(box.Text); }
}
else
{
}
}
xaml code
<toolkit:DataGridTemplateColumn Header="column1" Width="8*">
<toolkit:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Padding="0" LostFocus="OnGotFocus" GotFocus="OnGotFocus" />
</DataTemplate>
</toolkit:DataGridTemplateColumn.CellTemplate>
</toolkit:DataGridTemplateColumn>
Updated Xamal... set the textbox name to be the same as header name
then just got the name from my sender.... simplicity works
Thanks for the help https://stackoverflow.com/users/2047469/olaru-mircea