Open Symbai opened 5 years ago
I don't think the XAML parser allows leaving out DataTemplate
. Leaving it out would mean you are assigning TextBlock
(or rather, arbitrary UIElements
) to the CellTemplate
property directly.
Also you are going to confuse the designer even more than it is already, since DataTemplate is an indicator for a context switch (actually you often place a DataType
attribute on it to help the designer figure out its intellisense). Removing DataTemplate and making it an implicit context switch in the CellTemplate property is going to be really hard to support in design time intellisense. When you want to put bindings on your UIElements in the CellTemplate the designer won't have any clue you've switched context and it needs to show different intellisense.
I don't think the XAML parser allows leaving out
DataTemplate
. Leaving it out would mean you are assigningTextBlock
(or rather, arbitraryUIElements
) to theCellTemplate
property directly.
I think you misunderstood my request, or I am misunderstanding your answer.
Anyway like I said, the parser / designer /whatssover can automatically add a datatemplate when its missing. I'm not going to remove the datatemplate. I am going to remove the need of developers having to add/type these extra lines in xaml for 95% of all cases and let WPF do this job instead.
Similar as #84
Nope, not similar at all. #84 fits into the existing parser/designer implementation, it is just marking the property as default. This doesn't work here for the reasons I described above, #84 would correspond to removing DataGridTemplateColumn.CellTemplate
tag not the DataTemplate
tag.
I'm not saying its impossible to implement your suggestion but it would require changing how the parser/designer works currently.
Would it be possible to automatically assume the content of CellTemplate is a DataTemplate? I think this is what is the case for 95%. Honestly I haven't seen any other case yet.
I.e. instead of this:
You can write:
Unless specified otherwise.