Q:

Remove an item from listbox in WP8

I'm new to windows phone development.  I'm trying to delete selected item from the list box.  I've got dataclass
public class MyDataClass 
{ 
    public string MSG { get; set; } 
    public int Id { get; set; } 
}

Then I try to delete the selected item  (Button1_Click event) 
MyDataClass item = MyDict. SelectedItem as MyDataClass; 
ObservableCollection dataList = new ObservableCollection(); 
dataList. Remove(item);

The problem in creating the datalist in task, so it's no availble for the rest of the program, how to change this? 
    public async Task GETFROMDB()
    {
        int a = 1;
        Database database = new Database(ApplicationData. Current. LocalFolder, "DictData.db");
        await database. OpenAsync();
        string query = "SELECT * FROM MyDICT";
        Statement statement = await database. PrepareStatementAsync(query);
        statement. EnableColumnsProperty();
        ObservableCollection<MyDataClass> dataList = new ObservableCollection<MyDataClass>();
        while (await statement. StepAsync())
        {
            rawData = string. Format(statement. Columns["value"]);
            string[] sep = new string[] { "\r\n" }; //Splittng it with new line
            string[] arrData = rawData. Split(sep, StringSplitOptions. RemoveEmptyEntries);
            foreach (var d in arrData)
            {
                dataList. Add(new MyDataClass() { MSG = d, Id= a });
                a++;
            }
        }
        MyDict. ItemsSource = dataList;
    }

A:

Can you make binding to a dataList outside the Task and make dataList static or reference to it in a Task?   
When creating a list:
static ObservableCollection<MyDataClass> dataList = new ObservableCollection<MyDataClass>(); 
MyDict. ItemsSource = dataList;

Then in Task:
public async Task GETFROMDB()
{
    int a = 1;
    Database database = new Database(ApplicationData. Current. LocalFolder, "DictData.db");
    await database. OpenAsync();
    string query = "SELECT * FROM MyDICT";
    Statement statement = await database. PrepareStatementAsync(query);
    statement. EnableColumnsProperty();
    while (await statement. StepAsync())
    {
        rawData = string. Format(statement. Columns["value"]);
        string[] sep = new string[] { "\r\n" }; //Splittng it with new line
        string[] arrData = rawData. Split(sep, StringSplitOptions. RemoveEmptyEntries);
        foreach (var d in arrData)
        {
            dataList. Add(new MyDataClass() { MSG = d, Id= a });
            a++;
        }
    }
}

Then in Click:
MyDataClass item = MyDict. SelectedItem as MyDataClass; 
dataList. Remove(item);

Or make it:
When creating a list:
ObservableCollection<MyDataClass> dataList = new ObservableCollection<MyDataClass>(); 
MyDict. ItemsSource = dataList;

Then in Task:
public async Task GETFROMDB(ObservableCollection<MyDataClass> dataList)
{
    int a = 1;
    Database database = new Database(ApplicationData. Current. LocalFolder, "DictData.db");
    await database. OpenAsync();
    string query = "SELECT * FROM MyDICT";
    Statement statement = await database. PrepareStatementAsync(query);
    statement. EnableColumnsProperty();
    while (await statement. StepAsync())
    {
        rawData = string. Format(statement. Columns["value"]);
        string[] sep = new string[] { "\r\n" }; //Splittng it with new line
        string[] arrData = rawData. Split(sep, StringSplitOptions. RemoveEmptyEntries);
        foreach (var d in arrData)
        {
            dataList. Add(new MyDataClass() { MSG = d, Id= a });
            a++;
        }
    }
}

Then in Click:  
 MyDataClass item = MyDict. SelectedItem as MyDataClass; 
 dataList. Remove(item);

Of course you need to wait until the Task is finished.