Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To answer a little more conceptually:</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.selector.selectedvaluepath.aspx" rel="noreferrer"><code>SelectedValuePath</code></a> defines which property (by its name) of the objects bound to the ListBox's <code>ItemsSource</code> will be used as the item's <code>SelectedValue</code>.</p> <p>For example, if your ListBox is bound to a collection of <code>Person</code> objects, each of which has <code>Name</code>, <code>Age</code>, and <code>Gender</code> properties, <code>SelectedValuePath=Name</code> will cause the value of the selected <code>Person</code>'s <code>Name</code> property to be returned in <code>SelectedValue</code>.</p> <p><em>Note that if you override the ListBox's ControlTemplate (or apply a Style) that specifies what property should display, <code>SelectedValuePath</code> cannot be used.</em></p> <p><code>SelectedItem</code>, meanwhile, returns the entire <code>Person</code> object currently selected. </p> <p>(Here's <a href="http://msdn.microsoft.com/en-us/library/ms788714.aspx" rel="noreferrer">a further example from MSDN</a>, using TreeView)</p> <p><strong><em>Update:</strong> As @Joe pointed out, the DisplayMemberPath property is unrelated to the Selected* properties. Its proper description follows:</em></p> <p>Note that these values are distinct from <code>DisplayMemberPath</code> (which is defined on ItemsControl, not Selector), but that property has similar behavior to <code>SelectedValuePath</code>: in the absence of a style/template, it identifies which property of the object bound to item should be used as its string representation.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload