I have a XamGrid with two columns, Name and Type. Depending on Type, I want to have a different kind of column for Name, thus I'm using a TemplateColumn. In the data template I have a ContentControl with a default ContentTemplate and a DataTrigger that sets the ContentTemplateto a different column style if Type is a specific value. I am setting alll four templates (ItemTemplate, EditorTemplate, AddNewRowItemTemplate, AddNewRowEditorTemplate) of the TemplateColumn to this data template.
Name
Type
TemplateColumn
ContentControl
ContentTemplate
DataTrigger
ItemTemplate
EditorTemplate
AddNewRowItemTemplate
AddNewRowEditorTemplate
ItemTemplate, AddNewRowItemTemplate and AddNewRowEditorTemplate work as intended, however EditorTemplate does not, it just shows the name of the bound data type.
Please see here on SO for example pictures and my code.
Hello B,
Thank you for your feedback and sharing the information concerning your application requirement and its resolution. I am glad that this works for you and I believe that other community members may benefit from this as well.
Regards,
Thank you for the explanation! I will use this to answer my question on StackOverflow, if you don't mind.
As far as I can see in the control code, the mechanism for applying the Editor Template for the AddNewRow cell and the grid inner cell is different – the second one is more complicated because of the different features that may be enabled for the xamGrid cells. At some point – probably because of the specific of the DataTemplate resource, the EditorStyle property is expected to have a value.
Let me know if you have any questions with this matter.
Thanks for the fast reply, it works! Could you maybe explain why the EditorStyle is needed for the EditorTemplate, but for the AddNewRowEditorTemplate it's not?
I’ve attached a modified sample.
Let me know if I may be of further assistance.