D J
D J

Reputation: 7028

mouse click expander + select item issue in listview

I have a list view in which each list view item is an expander control. Now when I click on expander to open or close it, I want the item to be selected also. But its not happening. Only expander expands.

Looks like my event from expander is not reaching to the list view.

Any idea how to do it?

Thanks

Upvotes: 2

Views: 1124

Answers (1)

Gustavo Calderon
Gustavo Calderon

Reputation: 51

Inside the "ListView" set the container style like this...

 <ListView.ItemContainerStyle>
      <Style TargetType="{x:Type ListViewItem}">
           <Style.Triggers>
               <Trigger Property="IsKeyboardFocusWithin" Value="True">
                     <Setter Property="IsSelected" Value="True"/>
               </Trigger>
           </Style.Triggers>
      </Style>
 </ListView.ItemContainerStyle>

Got answer from: Link

Upvotes: 3

Related Questions