为什么我不能使用c#将数组绑定到dependencyproperty?

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'

如何
为什么这个错误发生,不要我注册其源类型为字符串数组?怎么解决?

her*_*ter 5

错误消息是正确的.你忘记了[]你的房产类型.

public string[] TaskList
{
    get { return (string[])GetValue(TaskListProperty); }
    set { SetValue(TaskListProperty, value); }
}
Run Code Online (Sandbox Code Playgroud)