Layers issue using Z-Index

∥☆過路亽.° 提交于 2019-12-11 03:24:17

问题


I've 2 controls one on top of another: border over slider. on border user can mark a segment to appear in different color on slider. Because the border is written after slider in xaml, it appear on top of the slider. and that's ok. My problem is, the Thumb of slider also appears under the border.

How can I set the Thumb element (belong to slider control and inside it) to appear on top of all, and also the border will appear on top of the slider? I tried use zIndex but without success. Any idea?


回答1:


In CSS:

Make sure your elements are positioned absolutely or relatively. z-index doesn't really have a play in layering unless the elements are positioned absolutely or relatively. You should then be able to set one with:

z-index: 1;

and the other with:

z-index: 2;

and get the desired result.

In WPF:

Use the syntax specified here

Here's an example:

Make sure both of your elements are in the same parent, otherwise they will be displayed in the order in which they were loaded.



来源:https://stackoverflow.com/questions/4195467/layers-issue-using-z-index

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!