Microsoft
70-511 · Question #155
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. The application contains a ListBox control named IbxItems that is…
The correct answer is C. { Binding ElementName=IbxItems, Path=SelectedItem.DisplayValue }. See the full explanation below for the reasoning.
Question
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. The application contains a ListBox control named IbxItems that is data-bound to a collection of objects. Each object has a DisplayValue property. You add a Button control to the application. You need to ensure that the Content property of the Button control is data-bound to the DisplayValue property of the selected item of IbxItems. Which binding expression should you use?
Options
- A{ Binding ElementName= IbxItems, Source=SelectedItem, Path=DisplayValue }
- B{ Binding Source=lbxItems, ElementName=SelectedItem, Path=DisplayValue }
- C{ Binding ElementName=IbxItems, Path=SelectedItem.DisplayValue }
- D{ Binding Source=lbxItems, Path=SelectedItem.DisplayValue }
How the community answered
(23 responses)- A9% (2)
- B13% (3)
- C74% (17)
- D4% (1)
Community Discussion
No community discussion yet for this question.