Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Getting Attribute from XmlElement in XAML

 
 
Old 01-30-2008   #1 (permalink)
john


 
 

Getting Attribute from XmlElement in XAML

All:

I am using this simple XML file as a test:

<students>
<student fname="Adam" />
<student fname="Bob" />
</students>

I have used an XmlDataProvider to bind these items to a ListBox's
ListBoxItems. This mechanism causes the ListBox to hold XmlElements.
Works fine.

I'm trying to set up a binding so that when the user selects a
ListBoxItem, the fname is displayed in a TextBox. If I make the name
part of the inner text of the item, it works OK, e.g.,

<student>Charlie</student>

The text can then be retrieved via:
<TextBox Text="{Binding SelectedItem.InnerText,
ElementName=MyStudentList}"></TextBox>

The big question is -- Is it possible in XAML to get an atttribute of
an XmlElement from the SelectedItem of a ListBox? What would the sytax
be for the binding?

Thanks,
John

My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Please help getting data out of this XmlElement PowerShell
Is it possible to include XAML files into another XAML file? .NET General
How to insert the "modified time" attribute in "date taken" attribute in batch mode-in vista or theough a software? Vista file management


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46