Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

I am working with the WPF toolkits DataGrid in code and relying on auto-generated columns. How can I convert the data bound values for a specific auto-generated column?

0
Posted

I am working with the WPF toolkits DataGrid in code and relying on auto-generated columns. How can I convert the data bound values for a specific auto-generated column?

0

Option #1: do the necessary conversions when the underlying data is gathered. Option #2: create a new binding that uses a custom value converter for the column you want to work with: • Create a handler for the DataGrid’s AutoGeneratingColumn event. This event is called once for each column that is auto-generated. • In the AutoGeneratingColumn event handler, examine the e.Column.Header property to see if the column being generated is the one you want to work with (where ‘e’ is the DataGridAutoGeneratingColumnEventArgs argument). • If you have found the column you are looking for, you can create a new Binding using the appropriate path as well as assign an instance of a value converter to do the conversion process.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.