0
votes

The ItemsSource (SsString) is a SortedSet string

I want to use a TextBox (not the default TextBlock) in a ListBox but I cannot figure out how to bind to the value in the SortSet.

I have tried binding with no path, Key, key, Value, and value.

    <ListBox ItemsSource="{Binding Path=SsString}">
        <ListBox.ItemTemplate>
            <DataTemplate>
                <TextBox Text="{Binding Path=Key}"/>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>

The following works but it displays TextBlock.

   <ListBox ItemsSource="{Binding Path=SsString}" />
1

1 Answers

1
votes

You won't be able to edit the bound values. You need a class as the item so you can target a property with the Binding.Path.

(You should be able to bind this using {Binding .}, but it's one-way)