Can't get focus on a TextBox inside a ListBox using Silverlight

Posted by Steve Temple on Stack Overflow See other posts from Stack Overflow or by Steve Temple
Published on 2010-04-28T10:19:08Z Indexed on 2010/04/28 10:23 UTC
Read the original article Hit count: 325

Filed under:
|

I'm having a little trouble in silverlight with a listBox containing databound textBox elements. The items display correctly in the list and the textBox is populated correctly but I can't get focus on the text box in the list. If I hover over the edges of the textBox it highlights but it won't let me click into it to edit the text. Any ideas?

My XAML looks like this:

<ListBox x:Name="listImages">
  <ListBox.ItemTemplate>
    <DataTemplate>
      <Grid x:Name="LayoutRoot" Background="White">
        <Image Height="102" HorizontalAlignment="Left" Name="imgThumb" Stretch="UniformToFill" VerticalAlignment="Top" Width="155" Source="{Binding ImageFilename, Converter={StaticResource ImageConverter}}" />
        <TextBox Height="23" HorizontalAlignment="Left" Margin="154,25,0,0" Name="txtAltText" VerticalAlignment="Top" Width="239" Text="{Binding Alt}" />
        <dataInput:Label Height="19" HorizontalAlignment="Left" Margin="154,6,0,0" Name="lblAltText" VerticalAlignment="Top" Width="239" Content="Alt Text" />
      </Grid>
    </DataTemplate>
  </ListBox.ItemTemplate>
</ListBox>

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about xaml