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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:59:03+00:00 2026-05-28T07:59:03+00:00

in my application i have this code: <Grid Name=BaseGrid> <Grid.Resources> <XmlDataProvider x:Name=ScenesXmlName x:Key=ScenesXml XPath=person

  • 0

in my application i have this code:

<Grid Name="BaseGrid">

        <Grid.Resources>
            <XmlDataProvider x:Name="ScenesXmlName" x:Key="ScenesXml" XPath="person" Source="myXml.xml"/>
        </Grid.Resources>
<ComboBox Grid.Column="0" Name="ScenariCombo" IsSynchronizedWithCurrentItem="True"
                  ItemsSource="{Binding Source={StaticResource ScenesXml}}" DisplayMemberPath="@name" />
</Grid>

Suppose my xml is:

<person name="John">
    <address>Some adress here</address>
    <work>Some work</work>
</person>

I’m planning to update several user controls when the selection changes.
the problem is that ComboBox.SelectedItem is not a custom object but an XmlNode as the Combobox is binded to an XmlDataSource.
How would you access an inner node ie: address of the SelectedItem item?

  • 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-28T07:59:03+00:00Added an answer on May 28, 2026 at 7:59 am

    I built a little example for you. It works but i am sure you can do better than that.

    my Xaml file:

    <Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
        xmlns:src="clr-namespace:WpfApplication1"
        Title="MainWindow" Height="350" Width="525">
    <Grid Name="BaseGrid">
        <Grid.Resources>
            <XmlDataProvider x:Name="ScenesXmlName" x:Key="ScenesXml" XPath="person" Source="myXml.xml"/>
            <src:Xml2AdressConverter x:Key="Xml2AdressConv"/>
        </Grid.Resources>
        <ComboBox Name="ScenariCombo" IsSynchronizedWithCurrentItem="True"
                  ItemsSource="{Binding Source={StaticResource ScenesXml}}" DisplayMemberPath="@name" Margin="0,0,272,264" />
        <Label Content="Address" Height="28" HorizontalAlignment="Left" Margin="12,110,0,0" Name="label1" VerticalAlignment="Top" Width="87" />
        <Label Content="Work" Height="28" HorizontalAlignment="Left" Margin="12,144,0,0" Name="label2" VerticalAlignment="Top" Width="87" />
        <TextBox Height="23" HorizontalAlignment="Left" Margin="134,115,0,0" Name="AddressTbx" VerticalAlignment="Top" Width="332" 
                 Text="{Binding ElementName=ScenariCombo, Path=SelectedItem, Converter={StaticResource Xml2AdressConv}, ConverterParameter=address}"/>
        <TextBox Height="23" HorizontalAlignment="Left" Margin="134,149,0,0" Name="WorkTbx" VerticalAlignment="Top" Width="332"
                  Text="{Binding ElementName=ScenariCombo, Path=SelectedItem, Converter={StaticResource Xml2AdressConv}, ConverterParameter=work}"/>
    </Grid>
    

    my Xml2AddressConverter class

    class Xml2AdressConverter : IValueConverter
    {
    
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            XmlElement xmlElt = value as XmlElement;
    
            if (xmlElt != null)
            {
                string str, attName;
                XElement xElt;
    
                attName = parameter as string;
    
                xElt= XElement.Load(xmlElt.CreateNavigator().ReadSubtree());
                str = "";
                foreach (XElement x in xElt.Descendants(attName))
                {
                     str = x.Value;
                }
                return str;
            }
            return "";
        }
    
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
    

    Have a look to this it shows a little bit how to query data from xml stuff using LINQ to XML.

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

Sidebar

Related Questions

I have this code to load icon and application name , but it is
I have this code: app = new Application(); app.Visible = false; workbook = app.Workbooks.Add(1);
I have this code in my ASP.NET application written in C# that is trying
I have this code in the end of link button click: Response.ContentType = application/zip;
Currently I have this code var App = Ember.Application.create(); App.user = Ember.Object.create({ people: customers
For eg, I have this code for my PHP calendar events application. /**MySQL code
I have this controller in Code Igniter application. A value is initialized in the
In many places in our application we have code like this: using(RAPI rapi =
I have an application with some bunch of code like this: errCode = callMainSystem();
I am using this article of architecture http://blog.extjs.eu/know-how/writing-a-big-application-in-ext/ in my code: I have this

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.