XmlDataProvider With TwoWay Binding In WPF
Hello, Here's a simple example of two-way binding in WPF using XMLDataProvider. This post is taken from John Papa's example in MSDN magazine years ago but with minor errors. The XMLDataProvider markup has color values and is declared inside Window.Resources node. <Window.Resources> <XmlDataProvider x:Key= "MoreColors" > <x:XData> <colors xmlns= '' > <color name= "pink" /> <color name= "white" /> <color name= "black" /> <color name= "cyan" /> <color name= "gray" /> <color name= "magenta" /> </colors> </x:XData> </XmlDataProvider> </Window.Resources> The Textbox control's Text Text property binding has been set to TwoWay so when you enter a color name it will be added as a ListBox Item. <Grid> <StackPanel> <TextBlock Width= "248" Height= "24"