IconElement.Foreground プロパティ

定義

前景色を表すブラシを取得または設定します。

public:
 property Brush ^ Foreground { Brush ^ get(); void set(Brush ^ value); };
Brush Foreground();

void Foreground(Brush value);
public Brush Foreground { get; set; }
var brush = iconElement.foreground;
iconElement.foreground = brush;
Public Property Foreground As Brush
<icon Foreground="{StaticResource resourceName}"/>
- or -
<icon Foreground="colorString"/>

プロパティ値

コントロールの前景を描画するブラシ。 既定値は null (null ブラシ) で、レンダリングでは Transparent と評価されます。 ただし、通常、この値は、アクティブなテーマやその他の設定に関連付けられている、実行時の既定のシステム リソースによって設定されます。

この例では、前景が "緑" に設定された SymbolIcon を使用する AppBarButton を示します。

<AppBarButton Label="Accept">
    <AppBarButton.Icon>
        <SymbolIcon Symbol="Accept" Foreground="Green"/>
    </AppBarButton.Icon>
</AppBarButton>

注釈

Foreground プロパティは、AppBarButton または IconElement 派生アイコンで設定できます。 AppBarButtonForeground を設定した場合、既定の表示状態にのみ適用されます。 など、MouseOver テンプレートで定義されている他の表示状態には適用されません。 IconElement 派生アイコンで Foreground を設定すると、色はすべての表示状態に適用されます。

Foreground 値の有効な ブラシ の種類は SolidColorBrush のみです。 純色を宣言していないブラシを使用しようとすると、その値は実行時に無視され、現在のテーマに応じて白または黒の SolidColorBrush に置き換えられます。

前景は BitmapIcon.UriSource ソース ファイルの色情報を置き換えます。 ソース イメージ内の透明でないピクセルは、前景色に置き換えられます。

適用対象

こちらもご覧ください