ListBoxItem selection on TextBox focus

前端 未结 1 923
情书的邮戳
情书的邮戳 2020-12-16 00:29

I have a ListBox showing items using the following DataTemplate:


  

        
相关标签:
1条回答
  • 2020-12-16 01:29

    I found that the answer is just to do this from the ListBoxItem standpoint, adding the following to its DataTemplate:

    <Style.Triggers>
      <Trigger Property="IsKeyboardFocusWithin" Value="True">
        <Setter Property="IsSelected" Value="True"/>
      </Trigger>
    </Style.Triggers>
    
    0 讨论(0)
提交回复
热议问题