/// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            //check if navigated to from MainPage or ItemDetails
            if (CheckLastPage(typeof(MainPage)))
            {
                // clear elements
                ListItems.Clear();
                // check if size, weight or weight and change title and mode appropriately
                string val = e.Parameter as string;
                Mode = val;

                switch (val)
                {
                case Util.SIZE:
                    title.Text = "Size";
                    break;

                case Util.WEIGHT:
                    title.Text = "Weight";
                    break;

                case Util.VOLUME:
                    title.Text = "Volume";
                    break;

                default:
                    break;
                }
            }
            else if (CheckLastPage(typeof(ItemDetails)))
            {
                // add element if not null (meaning cancelled), sort list
                GenericListItem val = e.Parameter as GenericListItem;
                if (val != null)
                {
                    ListItems.Add(val);
                    ListItems.Sort();
                }
            }
        }