Implicit DataTemplate doesn't work

前端 未结 1 1895
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-11 18:52

Why does the following implicit DataTemplate not work? Only the commented inline DataTemplate will work.

Note: If I remove both DataT

1条回答
  •  自闭症患者
    2021-01-11 19:41

    DataType requires the use of x:Type as the property's type is Object, so if you type DataType="ns:Type" you set it to the string "ns:Type". If the property's type were Type (as with Style.TargetType for example) the XAML processor would automatically convert that string to a Type.

    Thus here you should write:

      
        
      
    

    (The property type is Object to allow data-templating of XML data, see the documentation for more information on that)

    0 讨论(0)
提交回复
热议问题