
Please let me know how can I remove vertical grid line for last column only.
Thanks Dee
I am assuming AutoGenerateColumn=True. If so, use the AutoGeneratingColumn event which is called when the column is generated, which means the attribute to add in xaml would be AutoGeneratingColumn=DataGrid_AutoGeneratingColumn
And the handler code will be something like this
private void DataGrid_AutoGeneratingColumn(object sender, Microsoft.Windows.Controls.DataGridAutoGeneratingColumnEventArgs e)
{
if (e.PropertyName == "+") //or whatever it is
{
e.Cancel = false;
e.Column.Visibility = Visibility.Collapsed;
}
}
Update based on comment
This is just a simple example. Try setting cell style like so
In xaml add
<Style x:Key="noborder" TargetType="{x:Type dg:DataGridCell}">
<Setter Property="BorderThickness" Value="0"/>
</Style>
In the event handler add
e.Column.CellStyle = this.Resources["noborder"] as Style;
You can play with different style properties to get it right