We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Customise rendering when AutoGenerateColumns is True

This is all for the scenario where the sfDataGrid is bound to a list of entities of the same type.

1) We have some columns that use the data type DateTimeOffset - columns are not displayed for these (but I can see that the event AutoGeneratingColumn *is* fired for the column) presumably because no Renderer has been defined for that data type.

Is it possible to somehow customise the renderer that will be used for that column? eg provide our own renderer like the examples http://help.syncfusion.com/wpf/sfdatagrid/columns#how-to-override-existing-cell-types - but this example is for changing the renderer for an existing data type.  I would instead like to be able to specify a custom renderer for specific columns.

2) Similarly, if we have an entity that has a reference to another entity (or perhaps collection of entities) is it possible (again using AutoGenerateColumns="True") to specify a custom renderer for that column?

eg if the main entity in the grid is:
public class MyEntity() {
   public int ID {get; set;}
   public MyOtherEntity Related {get; set;}
}
public class MyOtherEntity {
  public string Description {get; set;}
}
For instance when displaying a list of MyEntity in the grid, I would like my custom renderer - or any other mechanism - to look up the Description property on the related entity.

Again I can see that the AutoGeneratingColumn event is fired for that column so is it possible to hook into this to customise what's shown for the column?

The reason for needing AutoGenerateColumns="True" is that this needs to be a fairly generic solution.






2 Replies

ST Stebay September 22, 2015 02:12 PM UTC

To add to this - if it's possible in XAML using DataTemplates (but again using AutoGenerateColumns="True" and not specifying the columns in the XAML) then that would also be fine.


JG Jai Ganesh S Syncfusion Team September 23, 2015 02:25 PM UTC

Hi Stephen,


Thank you for using Syncfusion products.


We analyzed your query. A support incident to track the status of this query has been created under your account. Please log on to our support website to check for further updates


https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents


Please let me know if you have any questions.


Regards,

Jai Ganesh S


Loader.
Live Chat Icon For mobile
Up arrow icon