简体   繁体   中英

How to place markers in a DataGrid scrollbar

I have a DataGrid, on the scrollbar I would like to put a marker that shows what items are selected. How would something like this be accomplished?

Have had a look around for similar questions and tutorials with no luck.

In my opinion you should create a ControlTemplate for the scrollbar, in which the PART_Track part should be customized (eg by adding small rectangles at the different positions). Here you can find the default style and template for the ScrollBar.

You also have to add a new AttachedProperty to the ScrollBar class, so you have some place to store the positions you would like to mark.

Maybe it is better and easier to create a custom control , which is based on the ScrollBar , and add the required properties there. You still have to create a custom template for that control of course.

And finally, to apply a custom ScrollBar Style only to DataGrids see this question .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM