C# 将值从SQLITE DB设置为Datepicker和Listpicker

C# 将值从SQLITE DB设置为Datepicker和Listpicker,c#,sqlite,windows-phone-8,C#,Sqlite,Windows Phone 8,我正在编写代码,用于将数据从SQLITE数据库提取到Windows Phone应用程序页面上添加的控件。 在我的页面中有一个文本框DatePicker&Listpicker,我从SQLITE查询中获取数据,但它只显示在TextBox字段中,而不显示在其他控件中,如DatePicker和Listpicker Xaml代码: <toolkit:DatePicker Name="dpkDate" Margin="0,144,0,332" /> <toolkit:ListPicker

我正在编写代码,用于将数据从SQLITE数据库提取到Windows Phone应用程序页面上添加的控件。 在我的页面中有一个文本框DatePicker&Listpicker,我从SQLITE查询中获取数据,但它只显示在TextBox字段中,而不显示在其他控件中,如DatePicker和Listpicker

Xaml代码:

<toolkit:DatePicker Name="dpkDate" Margin="0,144,0,332" />
<toolkit:ListPicker x:Name="priority" Margin="10,233,10,188" ExpansionMode="ExpansionAllowed" Background="#FFF7EBEB" SelectedIndex="2">
    <ListBoxItem x:Name="high" Content="High" Foreground="Black"/>
    <ListBoxItem x:Name="medium" Content="Medium" Foreground="Black"/>
    <ListBoxItem x:Name="low" Content="Low" Foreground="Black"/>
</toolkit:ListPicker>
<ListBox HorizontalAlignment="Left" Height="287" VerticalAlignment="Top" Width="456" Name="TaskListBox" Margin="10,302,-10,0" Visibility="Collapsed"/>
<TextBox HorizontalAlignment="Left" Height="134" Margin="0,5,0,0" TextWrapping="Wrap" Text="Wrpite Note" VerticalAlignment="Top" Width="456" Name="TextField"/>
.cs代码

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    dbConn = new SQLiteConnection(DB_PATH);
    // Create the table Task, if it doesn't exist.
    dbConn.CreateTable<Task>();
    // Retrieve the task list from the database.

    try
    {
        string id = NavigationContext.QueryString["selectedItem"].ToString();
        //string note = NavigationContext.QueryString["selectedItem.Text"].ToString();
        //MessageBox.Show(id); //this retrive the index of selected item and display in message

        var note= dbConn.Query<Task>("select * from task where Id='" + id + "'").FirstOrDefault();
        if (note == null)
            MessageBox.Show("Note Not Present in DataBase");
        else
        {
            TextField.Text = note.Text;
            dpkDate.Value = DateTime.Parse(note.Text);
            ((ListBoxItem)priority.SelectedItem).Content = note.Text;
        //     Date = dpkDate.Value.Value.ToString(),
        //Text = TextField.Text,
        //Priority=((ListBoxItem)priority.SelectedItem).Content.ToString(), //here have to make change to get 

        }

    }
    catch { }
    // Create the database connection.

}
我错在哪里?请帮忙。 注意:你们可以在这里看到截图,我不能缩进,所以在这里发布截图

根据要求:班级任务结构 //表示任务表的任务类。类中的每个属性都成为数据库中的一个属性

public sealed class Task
{
    /// <summary>
    /// You can create an integer primary key and let the SQLite control it.
    /// </summary>
    [PrimaryKey, AutoIncrement]
    public int Id { get; set; }

    public String Date { get; set; }

    public string Text { get; set; }

    public String Priority { get; set; }

    public override string ToString()
    {
        return "------------------------------------\n "+ Id +"\n" + Date + "\n" + Text + " \n " + Priority + " \n------------------------------------ ";
    }
}

发布你的文本字段。文本值课堂任务的结构是什么?为什么要将note.Text分配给每个控件?我用类任务的结构更新了问题,我分配note.Text是因为在note中它显示selecteditem的所有详细信息,有关更多详细信息,请加入我的teamviewer并检查codeTextField。Text仅显示ListBoxTeamviewer ID 944 847 769密码:8933的选定项中的注释