当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - Why can't I save my AppointmentsSearchEventArgs to variable?

问题描述:

I have a rather simple problem (I bealive). I have this method:

 void appointments_SearchCompleted(object sender, AppointmentsSearchEventArgs e)

{

if (e.Results.Count() == 0)

{

results = "no events for the selected day";

//MessageBox.Show(results);

}

else

{

results = e.Results.Count() + " events found";

sourceItem = e.Results;

//MessageBox.Show(results);

}

}

And I can't "save" both results and sourceItem variables(which are class fields).

The Message box inside this method shows everything correct, howerver, on the outside results reverts to the default value.

网友答案:

The answer is simple: I didn't get how ansynch download works. In my case I had to create a reference to my MainPage class, and bind items in appointments_SearchCompleted method.

Simple as that.

分享给朋友:
您可能感兴趣的文章:
随机阅读: