Open rabbitism opened 1 year ago
FWIW, WinUI supports this implicitly. Newer controls like the TabView
create the DataTemplate as a TabItem which is then used as a container, which is something I completely forgot about in the discussion around the new items control. Granted they don't have the hierarchy of DataTemplates
to search here so I think a property to control it is reasonable.
FWIW, WinUI supports this implicitly. Newer controls like the
TabView
create the DataTemplate as a TabItem which is then used as a container, which is something I completely forgot about in the discussion around the new items control. Granted they don't have the hierarchy ofDataTemplates
to search here so I think a property to control it is reasonable.
Something similar to this property in WPF? I think the Menu and StatusBar are the only controls that has a property for this purpose too.
Is your feature request related to a problem? Please describe. I see many users complain about setting container styles according to data, for example, setting listboxitem background according to data. This can be achieved by setting ItemContainerTheme with properties bind to datacontext, however this is not intuitive, and not friendly to compiled binding especially when designing new collection controls for displaying complex data.
Describe the solution you'd like Add a new bool property like "UseItemTemplateForContainer", false by default. If this is set to true, then items will be built with ItemTemplate first, and then go through the process of checking if itself is container, and do the container generation/preparation. In this way, we can use ListBoxItem directly as root of ItemItemplate, without making a listboxitem inside another listboxitem. And it will have no impact on existing code.
Describe alternatives you've considered
Additional context