2
我用C#UWP编写。 ScrollBar
造型不起作用,但一些ScrollViewer
造型很好。滚动条的样式不起作用
我后面的代码:
Style ScrollBarStyle = new Style(typeof(ScrollBar));
ScrollBarStyle.Setters.Add(new Setter(ScrollBar.BackgroundProperty, new SolidColorBrush(Colors.Blue)));
Style ScrollViewerStyle = new Style(typeof(ScrollViewer));
ScrollViewerStyle.Setters.Add(new Setter(ScrollViewer.BackgroundProperty, new SolidColorBrush(Colors.Blue)));
Application.Current.Resources.Add(typeof(ScrollViewer), ScrollViewerStyle);
Application.Current.Resources.Add(typeof(ScrollBar), ScrollBarStyle);
它可以用C#代码吗?我只想更改滚动条的颜色 – Naduxa
使用c#代码更改滚动条背景颜色并不容易。如果你只想改变scrollBar的颜色。您只能在默认[样式](https://msdn.microsoft.com/en-us/library/windows/apps/mt299150.aspx)上更改'root'网格背景颜色。 –
非常感谢! – Naduxa