开发者

Problems in data initialization when using DatePicker

开发者 https://www.devze.com 2023-01-28 17:42 出处:网络
I got the DatePicker from this source http://silverlight.codeplex.com/ and I am trying to use use it in an App.

I got the DatePicker from this source http://silverlight.codeplex.com/ and I am trying to use use it in an App. I have the following flow: MainPAge -> EditItem (contains DatePicker) -> Date Selector Page (developed by DatePicker devs)

The problem is that I have this code in my EditItem page:

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
    {
        base.OnNavigatedTo(e);

        if(NavigationContext.开发者_运维问答QueryString["type"].ToString() == "edit")
        {
            PageTitle.Text = "Edit Task";
            PrepareEditTask();
        }

}

When I click on the date picker and select a date, I return to the page where I re-execute the OnNavigationTo method, which calls the PrepareEditTask method, which overrides the value I just chose for the date. I am, then, not able to change the date.

Can anyone tell me what I am doing wrong?

Thanks, Oscar


I found a workaround for this issue: I have a boolean flag that define if this is the first time I am accessing the page, if it is, I call the methods to set the state, if it is not, I do not call them, so I do not overwrite anything.

:)

0

精彩评论

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