Reputation: 12843
I want to create a DataGrid like this :
User can add-remove columns at run-time. as shown in the picture I have to use DatePicker and checkbox and other controls on specific Cells .
How can I do it using WPF DataGrid ?
I think I have to change DataTemplate of particular cell but I don't know how
Is DataGrid appropriate control for this case ?
Upvotes: 0
Views: 702
Reputation: 436
I would suggest putting all the filter controls(?) above the line below "suspended" in the header of the DataGrid. You can put in there whatever you want.
<Window.Resources>
<DataTemplate x:Key="MySpecialHeaderTemplate">
...
</DataTemplate>
</Window.Resources>
<Grid>
<DataGrid>
<DataGrid.Columns>
<DataGridTextColumn HeaderTemplate="{StaticResource MySpecialHeaderTemplate}"
Binding="{Binding ...}" />
<DataGridTextColumn HeaderTemplate="{StaticResource MySpecialHeaderTemplate}"
Binding="{Binding ...}" />
</DataGrid.Columns>
</DataGrid>
</Grid>
This is not easy, especially finding the ViewModel holding the data of those controls in the header, but it is possible.
Upvotes: 1