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

  • SEARCH
  • Home
  • 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 143297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:04:23+00:00 2026-05-11T08:04:23+00:00

In a listbox, when I select an item I still get some kind of

  • 0

In a listbox, when I select an item I still get some kind of border or space around my listboxitem creating the line you see in the image. I want to remove that line I put a circle around.

It already has HorizontalContentAlignment = "Stretch" by the way.

What am I doing wrong?

The problem:

alt text

  • 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. 2026-05-11T08:04:24+00:00Added an answer on May 11, 2026 at 8:04 am

    Matt’s right, in that it’s sort of a bug. The padding is hard coded in the ListBox template, rather than being tied to a property you can change.

    Best way to fix this is to redefine the template, like so:

    <ListBox>     <ListBox.Template>         <ControlTemplate TargetType='{x:Type ListBox}'>             <Border                  SnapsToDevicePixels='true'                  x:Name='Bd'                  Background='{TemplateBinding Background}'                  BorderBrush='{TemplateBinding BorderBrush}'                  BorderThickness='{TemplateBinding BorderThickness}'                  Padding='0'> <!-- This was originally 1 -->                 <ScrollViewer                      Focusable='false'                      Padding='{TemplateBinding Padding}'>                     <ItemsPresenter SnapsToDevicePixels='{TemplateBinding SnapsToDevicePixels}'/>                 </ScrollViewer>             </Border>             <ControlTemplate.Triggers>                 <Trigger Property='IsEnabled' Value='false'>                     <Setter                          Property='Background'                          TargetName='Bd'                          Value='{DynamicResource {x:Static SystemColors.ControlBrushKey}}'/>                 </Trigger>                 <Trigger Property='IsGrouping' Value='true'>                     <Setter                          Property='ScrollViewer.CanContentScroll'                          Value='false'/>                 </Trigger>             </ControlTemplate.Triggers>         </ControlTemplate>     </ListBox.Template>      <ListBoxItem>Item1</ListBoxItem>     <ListBoxItem>Item2</ListBoxItem>     <ListBoxItem>Item3</ListBoxItem> </ListBox> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When we select ListBox item we get a Bluish background color right? How can
When I select an item on my Listbox, a Textbox is filled with the
I have a ListBox, and when I select an item in that ListBox I
I am using Listbox with ItemTemplate, and when I select an item from the
I have a listbox in WPF, and when they select an item, it shows
How can I retrieve the value of a clicked item in a multi-select listbox?
Is there some way to set the Height attribute of a WPF multi-select ListBox
How do you change which item is outlined in a ListBox? See the following
How to get the last selected item in a .Net Forms multiselect ListBox? Apparently
I am unable to select desired item from the listbox (when i click on

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.