When the GridColumn.DisplayBinding is set in the XAML, provided XamlCompilation attribute is set as XamlCompilationOptions.Compile, the binding converter will not get fired, since the DisplayBinding property is of type “Binding” instead of “BindingBase”. Changing the type of the property would require lot of internal changes and type conversions. Thus, to resolve this issue, it is suggested to set the DisplayBinding of the column in the code behind.
Refer the below code example in which the above problem is bypassed by setting the GridColumn.DisplayBinding in code behind.
Note that the “GridColumn.DisplayBinding” is set in the ViewModel using “Behaviors” to retain the MVVM structure.
The following code example illustrates the implementation of the CustomConverter class.
On executing the above code example, the output is obtained as follows:
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:|