How can I remove the "classic" indented border from around my WPF ListView
control? Setting its BorderThickness
to 0 does not get rid of it.
To get rid of the indented border, you will need to find the specific border definition in the control template that is causing the behavior you want to modify; there are several of them, but it should be easy enough to figure out which one is causing the indentation using trial and error and/or Snoop.
To place a border around an element, WPF provides the Border element. Similar to other WPF elements, the Border has Width, Height, Background, and HorizontalAlignment and VerticalAlignment properties. Besides these common properties, Border has two properties that make Border a border.
Don't know if its a former version of WPF, but on Visual studio 2008 the following is enough to remove all borders and colors of a listview control
<ListView Background="Transparent" BorderThickness="0">
For a lot of the built-in WPF control styles, you need to override the ControlTemplate to get this level of control over the rendering.
Here is the MSDN page that provides the ListView ControlTemplate, with instructions on how to use it -- basically you are inserting local copies of all the styles for the ListView control, which then override the default control look and feel.
To get rid of the indented border, you will need to find the specific border definition in the control template that is causing the behavior you want to modify; there are several of them, but it should be easy enough to figure out which one is causing the indentation using trial and error and/or Snoop.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With