I use the code below to display the data, but the result seems to show the ToString() method of the object.
It seems to be failing to recognize that Model is of type model.
CodePudding user response:
You must not set the x:Key
attribute on the <DataTemplate>
, because that breaks the mechanism that automatically applies the DataTemplate:
<DataTemplate DataType="{x:Type local:model}">
See the DataType Remarks:
... When you set this property to the data type without specifying an x:Key, the DataTemplate gets applied automatically to data objects of that type. Note that when you do that the x:Key is set implicitly.