Alb*_*Gao -1 c# data-binding silverlight dependency-properties windows-phone-7
我做什么
创建一个用户控件,其中一个DependencyProperty绑定到一个字符串数组
public static readonly DependencyProperty TaskListProperty =
DependencyProperty.Register("TaskList",
typeof(string[]),
typeof(MainControl),
null);
public string TaskList
{
get { return (string[])GetValue(TaskListProperty); }
set { SetValue(TaskListProperty, value); }
}
Run Code Online (Sandbox Code Playgroud)
我
为此代码收到了什么错误
get { return (string[])GetValue(TaskListProperty); }
Run Code Online (Sandbox Code Playgroud)
错误:无法将类型'string []'隐式转换为'string'
如何
为什么这个错误发生,不要我注册其源类型为字符串数组?怎么解决?
错误消息是正确的.你忘记了[]
你的房产类型.
public string[] TaskList
{
get { return (string[])GetValue(TaskListProperty); }
set { SetValue(TaskListProperty, value); }
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
812 次 |
最近记录: |