为什么我不能从一个元素中找到ZIndex作为属性? [英] Why can't I find ZIndex as a property from an element?

查看:92
本文介绍了为什么我不能从一个元素中找到ZIndex作为属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用ChangeProperty行为,我可以从元素的相应面板更改每个属性,但是我无法访问属性ZIndex。为什么会这样,并且有一种解决方法可以在选择元素时更改元素的ZIndex? 

解决方案

我相信ZIndex是一个附加属性,所以它仅当您在Canvas中包含元素或附加该属性的另一个容器时才存在。

我认为您需要执行以下操作:

Canvas.SetZIndex(controlReference, newZIndexValue);

这是关于如何设置附加属性,而不是具体zindex:
http://cornucopia30.blogspot.com/2006/12/wpf-how-to-programmatically-work-with.html

关于Canvas.ZIndex附加属性的文档:
http://msdn.microsoft.com/en-us/library/system.windows.controls.canvas.zindex(VS.95)的.aspx

-David

With the ChangeProperty behavior I can change every property from the corresponding panel of an element, but I can't access the property ZIndex. Why is that, and is there a workaround to change the ZIndex of an element when it's selected? 

解决方案

I believe that ZIndex is an attached property, so it only exists when you contain an element inside a Canvas or another container that attaches that property.

I think you need to do something like this:

Canvas.SetZIndex(controlReference, newZIndexValue);

This is about how to set attached properties, not specifically zindex:
http://cornucopia30.blogspot.com/2006/12/wpf-how-to-programmatically-work-with.html

Documentation on the Canvas.ZIndex attached property:
http://msdn.microsoft.com/en-us/library/system.windows.controls.canvas.zindex(VS.95).aspx

-David


这篇关于为什么我不能从一个元素中找到ZIndex作为属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆