7

I have a ScrollViewer in a ListView styled, but I cannot find the property to get rid of the bottom right corner as shown in the screenshot.

Example

Any ideas out of the property to set the background color?

2
  • You should include the code for your current control, including any theme or resource that is styling it. Commented Dec 10, 2013 at 20:56
  • Possible duplicate of Can't fully style a ListBox/Scrollviewer in WPF Commented Jan 21, 2019 at 9:49

1 Answer 1

12

The first thing to do here is look at the default template for ScrollViewer, you can find that from the MSDN documentation for it. Copy and paste that code into your XAML and then place the cursor over each component and it will highlight in the designer. If you're still having trouble then give your ScrollViewer a name (e.g. "theScrollViewer"), put a button on the page somewhere, hook up a Clicked handler for the button, put a breakpoint there, run your app, press the button, add "theScrollViewer" to your watch window and then click on the little magnifying glass to bring up the visualizer...that will let you traverse the visual tree and see which part of the control each section is rendering.

That said, the answer your question is to change the line with the Rectangle:

<Rectangle Grid.Column="1" Grid.Row="1" Fill="#FFE9EEF4"/> 
Sign up to request clarification or add additional context in comments.

2 Comments

Hello, Feldaman. Can I set the Rectangle Fill Property with code? Like scrollView.Set
@doubInt yes. In the 6 years since I wrote this the WPF team have given the Rectangle element a name, so now you can just access that directly rather than re-templating the entire control. The control template has to be loaded first though, so start by adding a handler i.e. myScrollViewer.Loaded += MyScrollViewer_Loaded;. Then, in that handler, simply do this: ((Rectangle)myScrollViewer.Template.FindName("Corner", myScrollViewer)).Fill = Brushes.Blue;.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.