Microsoft
70-511 · Question #2
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=lbxItems, 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=lbxItems, Path=SelectedItem.DisplayValue}
- D{Binding Source=lbxItems, Path=SelectedItem.DisplayValue}
How the community answered
(17 responses)- B12% (2)
- C82% (14)
- D6% (1)
Community Discussion
No community discussion yet for this question.