I know how to change the background color of a scrollbar:
<ScrollBar Height="27" Margin="36,96,12,0" Name="scrollBar1" Background="Red"></ScrollBar>
here is the picture with my red background:
How could I do the same thing with ScrollViewer? I have a grid inside my ScrollViewer and if I change the properties of ScrollViewer it seem to change the properties of the content inside my grid.
<ScrollViewer>
<Grid Name="Parent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
....
....
... etc
that produces:
with the content of my grid named Parent on the left. How could I place a red background on this ScrollViewer?
<Window.Resources>
<Style TargetType="ScrollBar">
<Setter Property="Background" Value="White"/>
</Style>
</Window.Resources>
In the above code, the programmer can give any color value he/she wants to set. For Eg, I have set the background color of my scrollbar to White.
Set the ScrollViewer style equal to a style that you build separately. Here are two links where the authors create a style first, and then apply said style to a wpf control after that:
http://www.codeproject.com/Articles/37366/Styling-A-ScrollViewer-Scrollbar-In-WPF.aspx
http://www.eggheadcafe.com/tutorials/aspnet/f51ddf8c-5227-4f1b-a5df-ec3d1b3439ca/styling-the-wpf-scrollviewer.aspx
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