w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Items collection must be empty before using ItemsSource, wpf datagrid

You have added the Style as data item, but apparently wanted to add it to the Resources of the SelfBindingDataGrid:

<dg:SelfBindingDataGrid ...>
    <dg:SelfBindingDataGrid.Resources>
         <Style TargetType="DataGridRow">
             ...
         </Style>
    </dg:SelfBindingDataGrid.Resources>
    ...
</dg:SelfBindingDataGrid>

If you intended to set the Style of the SelfBindingDataGrid, it should look like this:

<dg:SelfBindingDataGrid ...>
    <dg:SelfBindingDataGrid.Style>
         <Style TargetType="dg:SelfBindingDataGrid">
             ...
         </Style>
    </dg:SelfBindingDataGrid.Style>
    ...
</dg:SelfBindingDataGrid>




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.