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 1015619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:25:40+00:00 2026-05-16T10:25:40+00:00

I want to create a listbox that’ll be bound to XPath, relative to the

  • 0

I want to create a listbox that’ll be bound to XPath, relative to the other listbox’s currently selected item.

It’s using XmlDataProvider for the data, and the XML file looks like this:

<Programs>
    <Program name="...">
        <Step name="..."/>
        <Step name="..."/>
    </Program>
    <Program name="another">

    ...

</Programs

So, the “parent” listbox is listing out all the programs, while “child” shows only steps from the current program.
What’s such a type of binding called?

  • 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-16T10:25:41+00:00Added an answer on May 16, 2026 at 10:25 am

    Here you go. Hope this answers your question.

    <Window x:Class="StackOverflow.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:local="clr-namespace:StackOverflow"
            xmlns:uc="clr-namespace:StackOverflow.UserControls"
            Title="MainWindow" Height="350" Width="525">
        <Window.Resources>
            <XmlDataProvider x:Key="xml">
                <x:XData>
                    <Programs xmlns="">
                        <Program name="Program">
                            <Step name="Step1"/>
                            <Step name="Step2"/>
                        </Program>
                        <Program name="Program2">
                            <Step name="Step3"/>
                            <Step name="Step4"/>
                        </Program>
                    </Programs>
                </x:XData>
            </XmlDataProvider>
        </Window.Resources>
    
        <Grid>
            <StackPanel>
                <ListBox x:Name="parent" ItemsSource="{Binding Source={StaticResource xml}, XPath=Programs/Program}" 
                         Height="100">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding XPath=@name}"/>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
    
                <ListBox DataContext="{Binding ElementName=parent, Path=SelectedItem}" ItemsSource="{Binding XPath=Step}" 
                         Height="100">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding XPath=@name}"/>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </StackPanel>
    
        </Grid>
    </Window>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I want to create a looping listbox so that the last item's next
i want create a custom json data from the mssql 2008 results so that
I want to create an app that has a listbox on the left side
I want to create the content of the each item inside a ListBox dynamically
I want to create a custom control type that behaves exactly like a ListBox
I want to create a Style for a WPF ListBox that includes a Button
I have a for loop that I want (for every item in a ListBox
I want to create a ListBox that looks like the Windows Live Tiles .
I want to create a ListBox control that allows the user to edit items,
I want to check if an item has been selected in ListBox when user

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.