Hello,
I am writing code for Windows Phone application, in this I am showing the Reminder Alert Box when time will come, I want when I will tap on that reminder alert box, it will navigate to one page with those Reminders details. So How I can do.
_Content = TextField.Text;
_Date = dpkDate.Value.Value;
_Time = tpkDate.Value.Value.TimeOfDay;
_Date = _Date.Date + _Time;
Uri navigationUri = new Uri("/MainPage.xaml", UriKind.Relative); //Here I want to send parameter cause to show all details about reminder on MainPage.xaml
_Date = dpkDate.Value.Value;
_Time = tpkDate.Value.Value.TimeOfDay;
_Date = _Date.Date + _Time;
Uri navigationUri = new Uri("/MainPage.xaml", UriKind.Relative); //Here I want to send parameter cause to show all details about reminder on MainPage.xaml
var newReminder = new Reminder(_Date.ToString())
{
Content = _Content,
BeginTime = _Date,
RecurrenceType = RecurrenceInterval.None,
NavigationUri = navigationUri,
// sound= new Uri("music1.wav",UriKind.Relative)
};
ScheduledActionService.Add(newReminder);
{
Content = _Content,
BeginTime = _Date,
RecurrenceType = RecurrenceInterval.None,
NavigationUri = navigationUri,
// sound= new Uri("music1.wav",UriKind.Relative)
};
ScheduledActionService.Add(newReminder);
So Can I do this? & if yes, How?

Aditya PatilPosted Aug 1, 2014, 1:04 AM
1) You can pass parameters as you would in a query string in a normal URL. Eg:
Uri navigationUri = new Uri("/MainPage.xaml?date=" + _Date.ToString(), UriKind.Relative);
On the page you navigate to you can get the values like so:
string strDate = "";
NavigationContext.QueryString.TryGetValue("date", out strDate);
DateTime dtmDate = DateTime.Parse(strDate);
2) You can store your values in IsolatedStorage before navigating and retrieve them on the navigated to page. Eg:
starting page:
IsolatedStorageSettings.ApplicationSettings["date"] = _date;
target page
if (IsolatedStorageSettings.ApplicationSettings.Contains("date"))
{
DateTime dtmDate = (DateTime)IsolatedStorageSettings.ApplicationSettings["date"];
}
So, you could store your variables in an object and pass that via IsolatedStorage:
public class Reminder
{
public string _Content { get; set; }
public DateTime _Date { get; set; }
public DateTime _Time { get; set; }
public DateTime _DateTime { get; set; }
}
Reminder objReminder = new Reminder();
objReminder._Content = TextField.Text;
objReminder._Date = dpkDate.Value.Value;
objReminder._Time = tpkDate.Value.Value.TimeOfDay;
objReminder._DateTime = _Date.Date + _Time;
IsolatedStorageSettings.ApplicationSettings["objReminder"] = objReminder;
Then on your target page retrieve your object:
if (IsolatedStorageSettings.ApplicationSettings.Contains("objReminder"))
{
Reminder objReminder = (Reminder)IsolatedStorageSettings.ApplicationSettings["objReminder"];
//Get your values and do what you want
}
Hope this helps others those bogged down at same problem.
Aditya PatilPosted Jul 30, 2014, 6:39 AM
//Creation of the Reminder
_Content = TextField.Text;
_Date = dpkDate.Value.Value;
_Time = tpkDate.Value.Value.TimeOfDay;
_Date = _Date.Date + _Time;
Uri navigationUri = new Uri("/MainPage.xaml?param1=" + _Content + "¶m2=" + _Date.Date + "¶m3=" + _Time + "¶m4=" + ((ListBoxItem)priority.SelectedItem).Content.ToString(), UriKind.RelativeOrAbsolute);
var newReminder = new Reminder(_Date.ToString())
{
Content = _Content,
BeginTime = _Date,
RecurrenceType = RecurrenceInterval.None,
NavigationUri = navigationUri,
// sound= new Uri("music1.wav",UriKind.Relative)
};
ScheduledActionService.Add(newReminder);
//Code to access the value in next page
String note1 = NavigationContext.QueryString["param1"].ToString();
String date1 = NavigationContext.QueryString["param2"].ToString();
String time1 = NavigationContext.QueryString["param3"].ToString();
String prio = NavigationContext.QueryString["param4"].ToString();
TextField.Text = note1;
dpkDate.Value = DateTime.Parse(date1);
tpkDate.Value = DateTime.Parse(time1);
if (prio == "High")
priority.SelectedIndex = 0;
else if (prio == "Medium")
priority.SelectedIndex = 1;
else
priority.SelectedIndex = 2;
flagr = true;