Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8800511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:36:29+00:00 2026-06-14T00:36:29+00:00

I am trying to create a custom control like the one described in at:

  • 0

I am trying to create a custom control like the one described in at: https://stackoverflow.com/a/13188979/637142

So far I have a listview as:

<ListView Name="listBox1">

        <!-- Place items horizontaly -->
        <ListView.ItemsPanel>
            <ItemsPanelTemplate>
                <StackPanel Orientation="Horizontal" ></StackPanel>
            </ItemsPanelTemplate>
        </ListView.ItemsPanel>

        <ListView.ItemContainerStyle>
            <Style TargetType="{x:Type ListViewItem}">
                <Style.Resources>                        
                    <!-- Background for Selected ListViewItem -->
                    <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
                             Color="Yellow"/>
                </Style.Resources>
            </Style>
        </ListView.ItemContainerStyle>

        <!-- The items on the listview  -->
        <ListView.Items>
            <TextBlock Margin="5">Test1</TextBlock>
            <TextBlock Margin="5">Test2</TextBlock>
            <TextBlock Margin="5">Test3</TextBlock>
        </ListView.Items>

</ListView>

The only problem that I have now is when the user selects a item with the arrow keys. For example if I select a item with the mouse this is how it looks:

enter image description here

But if I select the same item with the arrow keys this is how it looks:

enter image description here

How can I remove the black dotted border from the selected item!

I do not want to add the previewKeyDown event and then handle it like

 if (e.Key == Key.Left)
 {
         listBox1.SelectedIndex--;
         e.Handled = true;
 }
 else if (e.Key == Key.Right)
 {
         listBox1.SelectedIndex++;
         e.Handled = true;
 }

Because I will also like to be able to select multiple items with the shift key.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T00:36:30+00:00Added an answer on June 14, 2026 at 12:36 am

    ListViewItem has a property called FocusVisualStyle that defines the border.

    You can simply set the property to null to remove the border:

    <ListView.ItemContainerStyle>
        <Style TargetType="{x:Type ListViewItem}">
            <Style.Resources>
    
                <!-- Background for Selected ListViewItem -->
                <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
                            Color="Yellow"/>
            </Style.Resources>
    
            <!-- Make sure the dotted border is never shown on ListViewItem -->
            <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        </Style>
    </ListView.ItemContainerStyle>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a custom control, which behaves a bit like one
I am trying to create a custom CStatic control in vc++ and have a
I've been trying to create a custom control that works exactly like the Panel
we have a problem when trying to create events for a custom control in
I'm trying to create a custom control - a button - which will have
I'm trying to create a custom control by deriving from a ZedGraphControl I need
I am trying to create a custom wpf control, I'm wondering how I can
I am trying to create a custom property in a extended control, so that
I'm trying to create a custom component to extend PrimeFaces. I have a simple
I am trying to create a custom control which does nothing except decorate the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.