开发者

WP7: can I access items on mainpage.xaml from app.xaml.cs?

I want to preload some setting on mainpage.xaml but only app is launched one time. I kno开发者_开发问答w I should use Application_Launching event in app.xaml but How can I set first value of my textbox on mainpage.xaml? thanks.


You can use IsolatedStorage for your textbox. Tombstoning sample


I thought Isolatedstorage is like notepad of windowsphone where i can store some data but not initially values. maybe my explanation was very unclear. simply a sample, I want to set my datepicker initially take 1 day later than today. I did that first just like this

    private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
    {

        dtpDate.Value = DateTime.Now.AddDays(1);

    }

but then I realized if user tries to change datapickers value, it causes page loaded again and it takes inital value. secondly, I learnt I should use Application_Launching event in app.xaml but I couldnt figure out how to set this below from app.xaml

dtpDate.Value = DateTime.Now.AddDays(1);

thanks for your help

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜