By default the SL4 PivotViewer control displays a custom control for controling the zoom-level of the tile views. A few people have expressed a wish to totally reskin the control and this is a step along that path that hints at the technique needed to dig deeper into the PivotViewer visual tree.
This short post shows how to locate the UI element for the control bar, the ZoomSlider, all its visual elements and then alter their background.
Locating the UI Elements
The flow of the code goes something like this:
- Locate the “PART_Container” in the tree. This is a Grid control.
- Or… go direct to the “PART_ControlBar” element.
- Locate the ControlBarView to access the child controls.
- Build a list of child controls using VisualTreeHelper.
If you want to try out the code there are a few things to watch out for.
You will need some internal Microsoft Pivot references and usings too. Depending upon the extent of your other customizations you will need these:
Further things to do
- Xpert360 PivotViewer Blog Article Index
- The code should be nicely wrapped up and encapsulated in the CustomPivotViewer override class.
- PivotViewer Control – Public API
- Microsoft Silverlight Forums – PivotViewer Control
- Xpert360 Ltd – who allow time for blogging
This article is a brief guide to locating some visual elements of the Silverlight PivotViewer control in order to customize the styling of the ZoomSlider control. It targets the developer who has already started customizing the Silverlight PivotViewer control beyond the public API.
Any comments or request for future topics are welcome.