Hello,
You can create the datatemplate for the insertion row and add and remove it dynamically:
Datatemplate for insertion row:
<DataTemplate x:Key="InsertionRow">
<xcdg:InsertionRow ReadOnly="False"
Loaded="InsertionRow_Loaded"
EditEnded="InsertionRow_EditEnded"
EditEnding="InsertionRow_EditEnding"
EditBeginning="InsertionRow_EditBeginning"
Background="Transparent"
EditTriggers="CellIsCurrent"
Margin="1"/>
</DataTemplate>
Button Click Event Adding/Removing:
private void btnAdd_Click(object sender, ExecuteRoutedEventArgs e)
{
try
{
if !TblView.Headers.Contains((DataTemplate)this.Resources["InsertionRow"]))
{
this.TblView.Headers.Insert(0, ((DataTemplate)this.Resources["InsertionRow"]));
}
else
{
this.TblView.Headers.Remove((DataTemplate)this.Resources["InsertionRow"]);
if (btnAdd != null)
{
btnAdd.IsChecked = false;
IsInsertion = false;
}
}
}
catch (Exception)
{
}
}
whereTblView is property
public TableflowView TblView
{
get
{
return View as TableflowView;
}
}
Thanks,
Paras Sanghani
Nothing Is Impossible