Mega Code Archive

 
Categories / C# / WPF
 

XmlDataProvider and static Xml resource

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"   Title="Simple Window"> <Grid xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">   <Grid.Resources>     <XmlDataProvider x:Key="dataProvider" XPath="Employees">       <x:XData>         <Employees xmlns="">           <Employee Type="Beginner">             <YearOfWorking>1</YearOfWorking>           </Employee>           <Employee Type="Intermediate">             <YearOfWorking>2</YearOfWorking>           </Employee>           <Employee Type="Advanced">             <YearOfWorking>3</YearOfWorking>           </Employee>         </Employees>       </x:XData>     </XmlDataProvider>   </Grid.Resources>     <ListBox ItemsSource="{Binding Source={StaticResource dataProvider},XPath=Employee/YearOfWorking}" /> </Grid> </Window>