none
Moving cursor/mouse out of the listBox caused highlighted item color change in WPF RRS feed

  • Question

  • Hi, we have listBox in the GUI and if we click an item, it's highlighted with blue color, but if we move the mouse/cursor outside of the listBox area, the highligt color disappear and turn to outlined (maybe default system highlight from what read somewhere).

    Does anyone know how to fix this?


    Thanks in advance!

    Wednesday, January 29, 2020 1:00 AM

All replies

  • Could be the XAML, could be the code behind could be a combination of both so that leads to you providing more details.

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Wednesday, January 29, 2020 3:28 AM
  • Hi,

    Have you changed the listbox template?

    example:

     <Style  TargetType="ListBoxItem">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="ListBoxItem">
                            <Border Name="Border1">
                                <ContentPresenter/>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter TargetName="Border1" Property="Background" Value="Yellow"/>
                                </Trigger>
                               
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, January 29, 2020 6:30 AM
    Moderator