The extra 'column' is intended to show your row headers. If you want to turn it off, use a declaration like this...
<DataGrid HeadersVisibility="Column"></DataGrid>
The default value for HeadersVisibility
is "All".
Question
Can someone explain why there is this empty column (before Column1) in my data grid?
Here is the XAML
<DataGrid x:Name="mydatagrid" ItemsSource="{Binding}" AutoGenerateColumns="true" Margin="0,20,-3,-2" IsReadOnly="True" AutoGeneratingColumn="OnAutoGeneratingColumn"/>
The object class it is bound to is a subclass of INotifyPropertyChanged, and I am fairly certain that none of the properties of my class are causing that column to be there, because if they were, wouldn't the column have the name of that property?
Is there a better way to remove/hide this column without having to resort to negative left margins for the datagrid?
Solution
The extra 'column' is intended to show your row headers. If you want to turn it off, use a declaration like this...
<DataGrid HeadersVisibility="Column"></DataGrid>
The default value for HeadersVisibility
is "All".