sandy
sandy

Reputation: 736

How to remove an extra column at the start in DataGrid

I have a datagrid that is getting dynamically generated.Issue is i see a extra column blank though small in size at the start of datagrid.

    <DataGrid x:Name="individualGrid" Margin="0,2,0,0" Visibility="{Binding ElementName=individualFilter, Path=IsChecked, Converter={StaticResource BoolToVisibility}}" 
              Grid.Row="4" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" AutoGenerateColumns="True" VerticalScrollBarVisibility="Auto" Height="500"
              ItemsSource="{Binding ElementName=deptFilter, Path=SelectedItem.Individuals.View}" AutomationProperties.AutomationId="AID_UH_individualGrid" ColumnWidth="*" 
              MinColumnWidth="140" CanUserAddRows="False" AutoGeneratingColumn="IndividualGrid_OnAutoGeneratingColumn"/>

There was also one extra blank column at the end which i removed using ColumnWidth="*" but not sure how to remove this one at the start.Please help

SOLUTION

Setting HeadersVisibility="Column" resolved the issue.Thanks to Sajee!

Upvotes: 0

Views: 1410

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222582

set this to your datagrid ,

HeadersVisibility="Column"

Upvotes: 2

Related Questions