func<string,string,bool> is not a valid windows runtime parameter type (win 8.1)

拈花ヽ惹草 提交于 2019-12-24 07:13:13

问题


https://github.com/igorkulman/AutoCompleteBox/blob/master/AutoCompleteBox/AutoCompleteBox.cs

I download this control, But I cannot build it,

public Func<string, string, bool> SearchFunction
{
   get { return (Func<string, string, bool>)GetValue(SearchFunctionProperty); }
   set { SetValue(SearchFunctionProperty, value); }
}

When I try using SearchFunction as public,I am getting this error. When I change it as internal it is working but this time I can't access SearchFunction from my project.

Method 'CodeAutoComplete.AutoCompleteBox.SearchFunction.get()' has a parameter of type
 'System.Func<System.String, System.String, System.Boolean>' in its signature. Although 
this generic type is not a valid Windows Runtime type, the type or its generic parameters 
implement interfaces that are valid Windows Runtime types. Consider changing the type 
'System.Func<T1, T2, TResult>' in the method signature. It is not a valid Windows Runtime 
parameter type. C:\\..CodeAutoComplete\AutoCompleteBox.cs CodeAutoComplete (Windows 8.1)

What should I do?


回答1:


Instead of adding the file to a WindowsRuntimeComponent project, add it to Windows store class library (if you have already created the project you can change the output type to class library in project properties->Output type).
The problem is if you create a WindowsRuntime component, you are a lot more limited in what you can make public as everything you make public need to have a valid WindowsRuntime type mapping.



来源:https://stackoverflow.com/questions/18963923/funcstring-string-bool-is-not-a-valid-windows-runtime-parameter-type-win-8-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!