Question

i am trying to add my contents to another page on listpicker selection and on button click!!

for instance: i have an item on my list picker called 'Home', a text box, a button called 'Add' and a textblock on the other page called 'pgeHome'

When i select Home from the list picker, enter text into the textbox and click the Add button the entered text should be added to the textblock on the pgeHome page

//here is that part of the code!! i want the the content to get passed on listpicker item //selection followed with button click..

//this is where i have entered the items in the listpicker

namespace Reminder_Alarm_App.Utilities.ReminderPage

{

public partial class remTask : PhoneApplicationPage

{

public remTask()

{

InitializeComponent();

        category.Items.Add("Home");
        category.Items.Add("Office");
        category.Items.Add("Friends");
        category.Items.Add("Others");

   }

private void ApplicationBarAddButton_Click(object sender, EventArgs e)

{

//to add the items in the pgeHome page

if (category.selectedindex == 0)

{

Reminder reminder = new Reminder(name);

reminder.Title = titleTextBox.Text;

reminder.Content = contentTextBox.Text;

reminder.BeginTime = beginTime;

reminder.ExpirationTime = expirationTime;

reminder.RecurrenceType = recurrence;

reminder.NavigationUri = navigationUri;

// Register the reminder with the system.

ScheduledActionService.Add(reminder);

//code to pass the contents in the pgeHome page

}

//to add the items in the pgeOffice page

if (category.selectedindex == 1)

{

Reminder reminder = new Reminder(name);

reminder.Title = titleTextBox.Text;

reminder.Content = contentTextBox.Text;

reminder.BeginTime = beginTime;

reminder.ExpirationTime = expirationTime;

reminder.RecurrenceType = recurrence;

reminder.NavigationUri = navigationUri;

// Register the reminder with the system.

ScheduledActionService.Add(reminder);

//code to pass the contents in the pgeOffice page

}

//to add the items in the pgeFriends page

if (category.selectedindex == 2)

{

Reminder reminder = new Reminder(name);

reminder.Title = titleTextBox.Text;

reminder.Content = contentTextBox.Text;

reminder.BeginTime = beginTime;

reminder.ExpirationTime = expirationTime;

reminder.RecurrenceType = recurrence;

reminder.NavigationUri = navigationUri;

// Register the reminder with the system.

ScheduledActionService.Add(reminder);

//code to pass the contents in the pgeFriends page

}

//to add the items in the pgeOthers page

if (category.selectedindex == 3)

{

Reminder reminder = new Reminder(name);

reminder.Title = titleTextBox.Text;

reminder.Content = contentTextBox.Text;

reminder.BeginTime = beginTime;

reminder.ExpirationTime = expirationTime;

reminder.RecurrenceType = recurrence;

reminder.NavigationUri = navigationUri;

// Register the reminder with the system.

ScheduledActionService.Add(reminder);

//code to pass the contents in the pgeOthers page

}

}

please help.. I am expecting a solution from my fellow developers!! :)

Was it helpful?

Solution

This is how I was able to get the components of the selected item in Listpicker. Check if it helps you with something.

private void listbox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
        // If selected item is null, do nothing
        if (listbox.SelectedItem == null)
        {
            return;
        }
        else
        {
            MainClass.Class1 search = (MainClass.Class1)listbox.SelectedItem;
            NavigationService.Navigate(new Uri("/NewPage.xaml?parameter=" + search.id, UriKind.Relative));
        }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top