Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6033683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:31:09+00:00 2026-05-23T05:31:09+00:00

I have a Pivot item template that includes a listbox <controls:Pivot x:Name=MainPivot ItemsSource={Binding PivotItemHeaders}

  • 0

I have a Pivot item template that includes a listbox

 <controls:Pivot x:Name="MainPivot" ItemsSource="{Binding PivotItemHeaders}" Title="CLASS TIMETABLE"  >
        <controls:Pivot.HeaderTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding Description}"/>
            </DataTemplate>
        </controls:Pivot.HeaderTemplate>
        <controls:Pivot.ItemTemplate>
            <DataTemplate>
                <ListBox x:Name="Events" ItemsSource="{Binding allEventItems}" ItemTemplate="{StaticResource EventDisplay2}"/>
            </DataTemplate>
        </controls:Pivot.ItemTemplate>
    </controls:Pivot>

In the code behind I want to access the selectedItem of that listbox but I cannot ‘get’ to the listbox as such because ity is (presumably) within the template

i.e

this.NavigationService.Navigate(new Uri("/View/EventEdit.xaml?selectedEvent=" +  Events.SelectedItem, UriKind.Relative));

The Events listbox is not being recognised.

Assuminh I can pass get the object and pass it through as a parameter, what code can I use to retrieve it

I know its starts with
protected override void OnNavigatedTo(NavigationEventArgs e)
{
if (NavigationContext.QueryString.ContainsKey(“SelectedEvent”))
{

But I am unsure of the syntax/code to extract out the object from the parameters

Appreciate how I can get the selectedItem from this listbox and the code to get the object being passed through

  • thanks
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:31:09+00:00Added an answer on May 23, 2026 at 5:31 am

    Rather than attempt to access the ListBox, you could use the SelectionChanged event to be told when the value changes:

    <ListBox x:Name="Events" 
             ItemsSource="{Binding allEventItems}" 
             ItemTemplate="{StaticResource EventDisplay2}"
             SelectionChanged="Event_SelectionChanged" />
    

    And then in your code behind:

    private void Event_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        this.selectedEvent = (EventItem)e.AddedItems[0];
    }
    

    You can access the value using NavigationContext.QueryString["selectedEvent"], but you can only store strings in navigation query strings. If your listbox is currently bound to objects, you’ll need to select a key and then find that event from the second page using that key.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PivotControl that contains ListBox elements: <controls:Pivot Title=SECTIONS x:Name=pivotControl ItemsSource={Binding SectionViewModels}> <controls:Pivot.HeaderTemplate>
In a Windows Phone 7 page I have the following control: <controls:Pivot x:Name=Pivoter Title={Binding
I have in my Xaml a pivot control : <controls:Pivot ItemsSource={Binding ObjectList}> <controls:Pivot.HeaderTemplate> <DataTemplate>
I wish to have a Pivot control that has PivotItems but no pivot item
In my MainPage.xaml , I created a Pivot Control: <controls:Pivot Title=Powder God Name=PivotControl> .
I have this PivotItem: <controls:PivotItem Header=Biografie> <StackPanel> <ScrollViewer x:Name=textScroller Margin=10,0,10,0> <TextBlock Text={Binding Biography} TextWrapping=Wrap/>
I have table to test score data that I need to pivot and I
So I have a boat load of pivot tables that I upload everyday to
I have a Pivot, nothing in the slightest bit unusual and the listbox displays
I have an array of Image URLS .I want to dynamically add Pivot item

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.