0

Consider a public class LogItem and a derived generic class LogItem<T> as shown below. After some wasted time searching for the correct syntax to specify the generic type in XAML, the editor was finally happy. Yet I got the error below trying to build the project. I am using VS 2017 Preview but I am guessing VS 2017 would barf just the same. If I omit the (system:Int32) part, everything goes as planned. I am using NET 4.6.2.

error MC3050: Cannot find the type 'modules:LogItem(system:Int32)'. Note that type names are case sensitive.

namespace App.Modules
{
    public class LogItem
    {
        public string Info { get; set; }
    }

    public class LogItem<T> : LogItem
    {
        public T Content { get; set; }
    }
}

    xmlns:modules="clr-namespace:App.Modules"
    xmlns:system="clr-namespace:System;assembly=mscorlib"

    <DataTemplate DataType="{x:Type modules:LogItem(system:Int32)}">
wpfwannabe
  • 14,587
  • 16
  • 78
  • 129

0 Answers0