Dynamically adding *custom* columns #220
-
|
Similar to #189 but I created this to add more detail and have it as reference for the docs. You may close this as duplicate if you see fit however. I've managed to dynamically add However, I've tried a lot of things and I can't figure out how to add these column types dynamically:
How do I dynamically add columns like this and is there any other/better way to add columns (and options for them on some occasions like for the ComboBoxColumn)? I will make sure to include this in the docs when I begin contributing. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
@Georgios1999 yes TableView creates date time columns for the DateOnly and TimeOnly automatically. for the ComboBox and ToggleSwitchcolumns, these columns are not generated automatically, but you can hook to the AutoGeneratingColumn event to see what type of column it will create for each property type. If you find the column inappropriate for the type, you can assign any column to the args.Column property within the event handler or can change behavior of the generated column as I do in SampleApp. |
Beta Was this translation helpful? Give feedback.
@Georgios1999 yes TableView creates date time columns for the DateOnly and TimeOnly automatically. for the ComboBox and ToggleSwitchcolumns, these columns are not generated automatically, but you can hook to the AutoGeneratingColumn event to see what type of column it will create for each property type. If you find the column inappropriate for the type, you can assign any column to the args.Column property within the event handler or can change behavior of the generated column as I do in SampleApp.
https://github.com/w-ahmad/WinUI.TableView.SampleApp/blob/41ff56cdf69f2ebc048846fb430c9a000cf2e21f/src/WinUI.TableView.SampleApp/ExampleModelColumnsHelper.cs#L7