user3791372
user3791372

Reputation: 4695

using TextBoxes inside a ListBox

I have a listbox, where I'm showing a list of titles. The user clicks the row to select the item which populates more textboxes.

However, the textboxes that I'm using in each row of the listbox are not clickable - the cursor changes to the text-selection cursor.

Is there something else that I should be using?

 <ListBox ItemsSource="{DynamicResource products}" Width="319" x:Name="productsListBox" Height="300">
    <ListBox.ItemTemplate>
      <DataTemplate>
        <TextBox Text="{Binding Title}" BorderThickness="0" IsReadOnly="True"/>
      </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

Upvotes: 0

Views: 57

Answers (1)

ASh
ASh

Reputation: 35730

readonly TextBox in template can be replaced with TextBlock

<DataTemplate>
    <TextBlock Text="{Binding Title}" BorderThickness="0"/>
</DataTemplate>

Upvotes: 2

Related Questions