Hi,
I need to change the style of scroll bar in xamdatagid. There are options to change the style of entire xamdatagid, but not the scroll bar. Any help is appreciated.
Regards!!
Paddy
The Scrollbar is buried in the Visual Tree for the XamDataGrid and I don't believe this element is accessible through a control template. The way to apply a style to the scroll bars is to use the VisualTreeHelper to locate the main ScrollViewer. Once you have access to this element you can apply a style to it.
To customize any scrollbar in WPF, you must override Scrollbar and ScrollViewer Control Templates. You can easily do that part in Expression Blend. Save these template overrides in a ScrollViewer style and then you can apply that style to any ScrollViewer.
One shortcut to all this is to make your ScrollViewer style global to the view that contains the XamDataGrid. This should work as well. Let me know if you have any problem or need further assistance.
Thanks!
Thanks, Curtis. Please lets us know if there is an sample code for the same. Appreciate your help.
The NetAdvantage Feature Browser Sample contains a custom scrollbar. You can do your own from scratch using Expression Blend template editors. Creating the entire ScrollViewer with custom ScrollBars, Thumbs and RepeatButtons is a little work. So I borrowed this example from the Feature Browser and placed it into a simple WPF application.
In the sample, there is a resource dictionary which contains a global ScrollViewer style. In the sample I have a XamDataGrid and a ListBox. By simply including this resource, the global ScrollViewer gets applied to both controls. You can use this sample to make your own ScrollBar styles to match your desired theme.
Thanks for posting the demo Curtis. The scrollbar is really nice except for one minor bug. When the scrollbar appears horizontally, the repeat buttons still scroll the grid up & down.
Wow! Thanks for telling me about this bug! I looked at it and there were two triggers missing. The two triggers hook up Left and Right commands to the ScrollBar RepeatButtons when the ScrollBar is positioned to be Horizontal.
I've fixed the bug in the sample and updated the project to work with version 10.3 of NetAdvantage (using VS2008).
Thank you!
Here is information about styling the ScrollBar:
http://msdn.microsoft.com/en-us/library/ms742878(VS.85).aspx
The ScrollBar is a Microsoft control and has several parts, thus the intricate Control Template.
You can also look at how Infragistics designers have customized the ScrollBar for our Themes by looking in the Default Styles folder. Here is a post about this:
http://ko.infragistics.com/community/forums/p/70625/357527.aspx
For example, in the following file you will find custom styles for the ScrollBars that appear in the XamDataGrid.
C:\Program Files\Infragistics\NetAdvantage 2012.1\WPF\DefaultStyles\DataPresenter\DataPresenterIGTheme_Express.xaml
or
C:\Program Files (x86)\Infragistics\NetAdvantage 2012.1\WPF\DefaultStyles\DataPresenter\DataPresenterIGTheme_Express.xaml
Simply look for : <Style TargetType="{x:Type ScrollBar}">
I looked over the examples and samples. They dont seem to be addressing the basic question . How do you
change the style of the scroll bar in a XamDataGrid. The Xaml shown changes Style of the ScrollViewer but not the scroll bar.
When I change the color in the scrollView - Property it changed the whole background to that color. I just want to operate on the scroll bars.
Also the example show the xamDataGrid with the same styled ( basic ) scroll bars.
Please let me know if change to the scroll bar style ( width, color... ) is possible in XamDataDrid. I am using version 12.