VisualElement.Opacity プロパティ

定義

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

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

プロパティ値

Double

不透明度の値。 既定の不透明度は 1.0 です。 値は、set で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;

適用対象