다음을 통해 공유


VisualElement.Opacity 속성

정의

렌더링될 때 요소에 적용되는 불투명도 요소를 가져오거나 설정합니다. 이는 바인딩 가능 속성입니다.

public double Opacity { get; set; }
member this.Opacity : double with get, set

속성 값

System.Double

불투명도 값입니다. 기본 불투명도는 1.0입니다. 값은 설정 시 0에서 1 사이로 고정됩니다.

설명

IsVisible이 이 아닌 한 불투명도 값은 true영향을 주지 않습니다. 불투명도는 요소 계층 구조에서 상속됩니다. 부모에 0.5 불투명도가 있고 자식의 불투명도가 0.5이면 자식은 유효 0.25 불투명도로 렌더링됩니다. 불투명도를 0으로 설정해도 입력 요소가 포함된 정의되지 않은 동작이 있습니다.

다음 예제에서는 레이아웃의 불투명도를 0.5로 설정하고 자식 중 하나의 불투명도를 0.5로 설정하여 자식이 25%를 불투명하게 만듭니다.

StackLayout stack = new StackLayout ();
Button button1 = new Button {Text="A Button"};
Button button2 = new Button {Text="Another Button"};

stack.Children.Add (button1);
stack.Children.Add (button2);

// The stack and everything in it will become 50% opaque
stack.Opacity = 0.5;

// button1 will become 25% opaque while the stack and button2 remane 50% opaque
button1.Opacity = 0.5;

적용 대상