VisualElement.Opacity プロパティ

定義

描画時に要素に適用する不透明度値を取得または設定します。 これはバインド可能なプロパティです。

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

プロパティ値

不透明度の値。 既定の不透明度は 1.0 です。 値は、セットに対して 0 から 1 の間でクランプされます。

注釈

IsVisible が の場合を除き、不透明度の値は無効です true。 不透明度は要素階層の下に継承されます。 親の不透明度が 0.5 で、子の不透明度が 0.5 の場合、子は有効な不透明度 0.25 でレンダリングされます。 不透明度を 0 に設定すると、入力要素での動作が未定義になります。

次の例では、レイアウトの不透明度を 0.5 に設定し、その子の 1 つの不透明度を 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;

適用対象