Which binding expression should you use?

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 lbxItems 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 lbxItems.
Which binding expression should you use?

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 lbxItems 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 lbxItems.
Which binding expression should you use?

A.
{ Binding ElementName=lbxItems, 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 }



Leave a Reply 0

Your email address will not be published. Required fields are marked *