C# 属性向控件及其父级指示
问: 最近,我问了一个关于设置(C# 属性向控件及其父级指示,c#,.net,asp.net,html,panel,C#,.net,Asp.net,Html,Panel,问: 最近,我问了一个关于设置(Visible)属性的问题,当我将其设置为true时,我惊讶地发现在将其设置为true后进行跟踪。它的值仍然为false。答案对我来说是一个惊喜: - "The Visible property has a special property: when you read the value it not only reports on the control itself but also on it's parent. The valu
Visible
)属性的问题,当我将其设置为true时,我惊讶地发现在将其设置为true后进行跟踪。它的值仍然为false。答案对我来说是一个惊喜:
- "The Visible property has a special
property: when you read the value it
not only reports on the control
itself but also on it's parent. The
value you get is the "real"
visibility."
我的问题是:有没有任何财产,你以前遇到过类似(
Visible
)的行为?我们应该如何以最佳方式使用它们?嗯,我不知道,试试这个查询:
var lst =Control.Properties.Where(p => HasSimilarBehaviourToVisibleProperty(p));
您只需要编写hasBehaviorLikeVisibleProperty
方法
注意:您可能需要反射来获取所有属性。(查看以获取属性)已启用可以是这种方式的一个属性。你是什么意思。。不清楚我希望所有属性的行为类似(
可见
)。