Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Store Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems.

Go Back   Vista Forums > Vista technology newsgroups > Avalon

Getting Attribute from XmlElement in XAML

Reply
 
Thread Tools Display Modes
Old 01-30-2008   #1 (permalink)
john
Guest
 
Posts: n/a

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
  Reply With Quote

Reply

Thread Tools
Display Modes









Vistax64.com 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 2005-2008

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 47 48