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

  • Home
  • SEARCH
  • 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 7166747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:27:48+00:00 2026-05-28T14:27:48+00:00

I have a list box like below. <ListBox x:Name=CouponListBox ItemsSource={Binding Item} SelectionChanged=CouponListBox_SelectionChanged> <ListBox.ItemTemplate> <DataTemplate>

  • 0

I have a list box like below.

<ListBox x:Name="CouponListBox" ItemsSource="{Binding Item}" SelectionChanged="CouponListBox_SelectionChanged">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <Image Source="{Binding MerchantImage}" Height="73" Width="73" VerticalAlignment="Top" Margin="0,10,8,0"/>
                                <StackPanel Width="130">
                                    <TextBlock Text="{Binding CustomerName}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
                                    <TextBlock Text="{Binding MerchantName}" TextWrapping="Wrap" FontSize="20" Foreground="#FFC4C4C4" Padding="10" />
                                    <TextBlock Text="{Binding Distance}" TextWrapping="Wrap" FontSize="16" Foreground="#FFC4C4C4" Padding="10" />
                                    <TextBlock Text="{Binding DistanceInMinutes}" TextWrapping="Wrap" FontSize="16" Foreground="#FFC4C4C4" Padding="10" />
                                </StackPanel>
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>

And I have a Change Event in .cs file which is

private void CouponListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // If selected index is -1 (no selection) do nothing
            if (CouponListBox.SelectedIndex == -1)
                return;
            // Navigate to the new page
            System.Diagnostics.Debug.WriteLine("this is a test::" + CouponListBox.SelectedItem.ToString());
            NavigationService.Navigate(new Uri("/DetailsPage.xaml?selectedItem=" + CouponListBox.SelectedIndex, UriKind.Relative));

           // Reset selected index to -1 (no selection)
            CouponListBox.SelectedIndex = -1;
        }

In DetailsPage I could able to print the item Index. But What I want is Customer ID passed in the URL like

"/DetailsPage.xaml?selectedItem=" + CouponListBox.SelectedIndex + "&customerId=" + couponId

Can anyone please tell me where I should include customerId in my XAML file? and that who can I call it in the function.

Thank you,
Karthik

  • 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-28T14:27:49+00:00Added an answer on May 28, 2026 at 2:27 pm

    Use this:

    if (this.NavigationContext.QueryString.ContainsKey("customerId")) 
    {
        string customerId = this.NavigationContext.QueryString["customerId"];
    }
    
    if (this.NavigationContext.QueryString.ContainsKey("selectedItem")) 
    {
        string selectedItem = this.NavigationContext.QueryString["selectedItem"];
    }
    

    in the usercontrol’s Loaded or other appropriate event.

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

Sidebar

Related Questions

I have a list box in expander: <ListBox ItemsSource={Binding MySource> <ListBox.ItemTemplate> <DataTemplate> <RadioButton Content={Binding
I have set my ListBox.ItemTemplate to something like below <ListBox.ItemTemplate> <DataTemplate> <StackPanel Margin=10> <TextBlock
So I have a list box that displays averages in a table like format
I have a listbox like so: list.DataSource = bindingSource; list.DisplayMember = column_name; Later I
I have a system.collections.generic.list(of ListBox) I would like to use the collection classes built-in
I have a list box control: <asp:ListBox runat=server id=lbox autoPostBack=true /> The code behind
I have a list box and i am trying to get currently checked item
I have a ListBox whose ItemsSource is bound to a list of objects. The
I have a Mediaplayer control on my XAML page like below: <CustomMediaElement:CustomMediaPlayer x:Name=custMediaElement VerticalAlignment=Center
I have two list boxes like show below, side by side. They both have

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.