Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WCF and WF
  4. XMLDataProvider

XMLDataProvider

Scheduled Pinned Locked Moved WCF and WF
wpfxmlcsswcfhelp
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mikla521
    wrote on last edited by
    #1

    Just discovered the XMLDataProvider, great! :) My problem this time is the binding. My XML file looks like this...with several products and more than one Coupler per product but with different Id.

    <CouplerSettings>
    <Product Id="C702">
    <Coupler Id="R+S Grid">
    <Attenuation Id="GSM850LowChRX" Value="8.9875" />
    <Attenuation Id="GSM850LowChTX" Value="7.745" />
    <Attenuation Id="GSM850MidChRX" Value="10.7375" />
    <Attenuation Id="GSM850MidChTX" Value="8.73375" />
    ....

    I select product in a ListBox, based on another file. Then I want to bind a TextBox to a Value with a specific Attenuation Id, that is within the same element. In my code I have

    String xpath = "CouplerSettings/Product[@Id='" + productName + "']/Coupler[@Id='R+S Grid']";
    XmlDataProvider providerCoupler = new XmlDataProvider();
    providerCoupler.Source = new Uri(@"D:\Programming\MyFile.xml");
    providerCoupler.XPath = xpath;
    WrapPanelCoupler.DataContext = providerCoupler;

    and in XAML

    <WrapPanel Name="WrapPanelCoupler" Grid.Row="2" MaxWidth="800">
    <TextBox Name="textbox1" Text="{Binding XPath=???

    If I select the C702 product and Coupler with Id="R+S Grid" and then want to bind the TextBox text to the Value where i.e the Attenuation Id="GSM850LowChRX", how to do that? If I change the code to

    String xpath = "CouplerSettings/Product[@Id='" + productName + "']/Coupler[@Id='R+S Grid']/Attenuation[@Id='GSM850LowChRX']";

    and

    <TextBox Name="textbox1" Text="{Binding XPath=@Value}

    does the trick but I really want the binding to include the Attenuation Id.

    M 1 Reply Last reply
    0
    • M mikla521

      Just discovered the XMLDataProvider, great! :) My problem this time is the binding. My XML file looks like this...with several products and more than one Coupler per product but with different Id.

      <CouplerSettings>
      <Product Id="C702">
      <Coupler Id="R+S Grid">
      <Attenuation Id="GSM850LowChRX" Value="8.9875" />
      <Attenuation Id="GSM850LowChTX" Value="7.745" />
      <Attenuation Id="GSM850MidChRX" Value="10.7375" />
      <Attenuation Id="GSM850MidChTX" Value="8.73375" />
      ....

      I select product in a ListBox, based on another file. Then I want to bind a TextBox to a Value with a specific Attenuation Id, that is within the same element. In my code I have

      String xpath = "CouplerSettings/Product[@Id='" + productName + "']/Coupler[@Id='R+S Grid']";
      XmlDataProvider providerCoupler = new XmlDataProvider();
      providerCoupler.Source = new Uri(@"D:\Programming\MyFile.xml");
      providerCoupler.XPath = xpath;
      WrapPanelCoupler.DataContext = providerCoupler;

      and in XAML

      <WrapPanel Name="WrapPanelCoupler" Grid.Row="2" MaxWidth="800">
      <TextBox Name="textbox1" Text="{Binding XPath=???

      If I select the C702 product and Coupler with Id="R+S Grid" and then want to bind the TextBox text to the Value where i.e the Attenuation Id="GSM850LowChRX", how to do that? If I change the code to

      String xpath = "CouplerSettings/Product[@Id='" + productName + "']/Coupler[@Id='R+S Grid']/Attenuation[@Id='GSM850LowChRX']";

      and

      <TextBox Name="textbox1" Text="{Binding XPath=@Value}

      does the trick but I really want the binding to include the Attenuation Id.

      M Offline
      M Offline
      mikla521
      wrote on last edited by
      #2

      Think I solved it myself this time :) Code behind:

      String xpath = "CouplerSettings/Product[@Id='" + productName + "']/Coupler[@Id='R+S Grid']";

      XAML

      <TextBox Text="{Binding XPath=Attenuation[@Id\=\'GSM850LowChTX\']/@Value}" />

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups