Reputation: 1560
I have a problem, I need some editable column in my grid, I do what I need, but when I set the IsReadOnly
property to False
on the grid, when loading the ItemSource, I get a phantom row. I already checked and the collection has the correct amount of items, is it a visual mistake?
<DataGrid AlternationCount="2"
SelectionMode="Single"
SelectionUnit="FullRow"
BorderThickness="0,3,0,3"
AutoGenerateColumns="False"
GridLinesVisibility="Horizontal"
ItemsSource="{Binding Articles}"
BorderBrush="{DynamicResource GrayBrush5}"
AlternatingRowBackground="{DynamicResource GrayBrush5}"
HorizontalGridLinesBrush="{StaticResource AccentColorBrush}">
<DataGridTextColumn Width="100"
Header="Code"
IsReadOnly="True"
Binding="{Binding Code}" />
Upvotes: 0
Views: 133
Reputation: 111
You should add the property CanUserAddRows="false" to delete the "phantom row".
Upvotes: 3