Wednesday, 5 September 2012

WPF binding xml file in coboBox



window1.xaml

<Window x:Class="WpfApplication1.ComboWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="ComboWindow" Height="300" Width="500">
    <Window.Resources>
        <ResourceDictionary>
            <XmlDataProvider x:Key="system_med" Source="/system_data_Med.xml" XPath="/Medication"></XmlDataProvider>
        </ResourceDictionary>
    </Window.Resources>
   
    <Grid>
        <ComboBox Height="23" HorizontalAlignment="Left" Margin="10,10,0,0" Name="comboBox1" VerticalAlignment="Top" Width="320" ItemsSource="{Binding Source={StaticResource system_med},XPath=/Medication/Medication/MedicationName}" />
    </Grid>
</Window>

system_data_Med.xml 

<Medication>
  <Medication>
    <MedicationId>11</MedicationId>
    <MedicationName>SEROMYCIN CAPSLUES</MedicationName>
    <medicationStrength>250</medicationStrength>
    <medicationUnit>MG</medicationUnit>
    <medicationUnitDescription>MG</medicationUnitDescription>
    <medicationRx>R</medicationRx>
    <dosageForm>
      <dosageDrug>CAPSULE</dosageDrug>
    </dosageForm>
    <package>
      <packageType>BOT</packageType>
      <packageType>40</packageType>
    </package>
    <route>
      <routeType>ORAL</routeType>
    </route>
    <formulation>
      <drugIngredient>CYCLOSERINE</drugIngredient>
      <drugStrength>250</drugStrength>
      <drugUnit>MG</drugUnit>
      <drugUnitDescrition>MILLIGRAM</drugUnitDescrition>
    </formulation>
  </Medication>
  <Medication>
    <MedicationId>33</MedicationId>
    <MedicationName>QUINIDINE GLUCONATE INJECTION USP</MedicationName>
    <medicationStrength>80</medicationStrength>
    <medicationUnit>MG|ML</medicationUnit>
    <medicationUnitDescription>MG|ML</medicationUnitDescription>
    <medicationRx>R</medicationRx>
    <dosageForm>
      <dosageDrug>INJECTION- SOLUTION</dosageDrug>
    </dosageForm>
    <package>
      <packageType>VIAL</packageType>
      <packageType>10 ML</packageType>
    </package>
    <route>
      <routeType>INTRAVENOUS</routeType>
      <routeType>INTRAMUSCULAR</routeType>
    </route>
    <formulation>
      <drugIngredient>QUINIDINE GLUCONATE</drugIngredient>
      <drugStrength>80</drugStrength>
      <drugUnit>MG</drugUnit>
      <drugUnitDescrition>MILLIGRAM</drugUnitDescrition>
    </formulation>
  </Medication>
  <Medication>
    <MedicationId>48</MedicationId>
    <MedicationName>CAPASTAT SULFATE INJECTION</MedicationName>
    <medicationStrength>1</medicationStrength>
    <medicationUnit>GM|10ML</medicationUnit>
    <medicationUnitDescription>GM|10ML</medicationUnitDescription>
    <medicationRx>R</medicationRx>
    <dosageForm>
      <dosageDrug>INJECTION- POWDER- FOR SOLUTION</dosageDrug>
    </dosageForm>
    <package>
      <packageType>VIAL</packageType>
      <packageType>1 X 10 ML</packageType>
    </package>
    <route>
      <routeType>INTRAMUSCULAR</routeType>
    </route>
    <formulation>
      <drugIngredient>CAPREOMYCIN SULFATE</drugIngredient>
      <drugStrength>0</drugStrength>
      <drugUnit>NS</drugUnit>
      <drugUnitDescrition>NOT STATED</drugUnitDescrition>
    </formulation>
  </Medication>
  <Medication>
    <MedicationId>158</MedicationId>
    <MedicationName>HUMATROPE FOR INJECTION</MedicationName>
    <medicationStrength>5</medicationStrength>
    <medicationUnit>MG|VIL</medicationUnit>
    <medicationUnitDescription>MG|VIL</medicationUnitDescription>
    <medicationRx>R</medicationRx>
    <dosageForm>
      <dosageDrug>INJECTION- POWDER- FOR SOLUTION</dosageDrug>
      <dosageDrug>LIQUID</dosageDrug>
    </dosageForm>
    <package>
      <packageType>VIAL</packageType>
      <packageType>6 X 5 ML</packageType>
      <packageType>VIAL</packageType>
      <packageType>1 X 5 MG</packageType>
    </package>
    <route>
      <routeType>SUBCUTANEOUS</routeType>
      <routeType>SUBCUTANEOUS</routeType>
      <routeType>INTRAMUSCULAR</routeType>
    </route>
    <formulation>
      <drugIngredient>SOMATROPIN</drugIngredient>
      <drugStrength>5</drugStrength>
      <drugUnit>MG</drugUnit>
      <drugUnitDescrition>MILLIGRAM</drugUnitDescrition>
    </formulation>
  </Medication>
</Medication>

No comments:

Post a Comment