Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The correct value is</p> <pre><code>DisplayMemberPath="(local:SelectorSwitchedControl.NameForSelector)" </code></pre> <p>If that is not working then I would use Snoop (<a href="http://snoopwpf.codeplex.com/" rel="nofollow">http://snoopwpf.codeplex.com/</a>) to make sure that the value is getting set correctly.</p> <p>Here is the simplest working example</p> <p>Xaml:</p> <pre><code>&lt;Window x:Class="WPFTest.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WPFTest" Title="MainWindow" Height="350" Width="525" Loaded="MainWindow_Loaded"&gt; &lt;Grid&gt; &lt;ComboBox Name="cb" DisplayMemberPath="(local:MainWindow.TestValue)" /&gt; &lt;/Grid&gt; </code></pre> <p></p> <p>Code:</p> <pre><code>public static string GetTestValue(DependencyObject element) { return (string)element.GetValue(TestValueProperty); } public static void SetTestValue(DependencyObject element, string value) { element.SetValue(TestValueProperty, value); } public static readonly DependencyProperty TestValueProperty = DependencyProperty.RegisterAttached("TestValue", typeof(string), typeof(MainWindow), new FrameworkPropertyMetadata(null)); private void MainWindow_Loaded(object sender, System.Windows.RoutedEventArgs e) { TextBlock tb = default(TextBlock); for (int i = 10; i &lt;= 15; i++) { tb = new TextBlock(); tb.Text = "Text for " + i; tb.SetValue(TestValueProperty, "Property For " + i); this.cb.Items.Add(tb); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    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. This table or related slice is empty.
    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