DataGrid.AlternatingRowBackground プロパティ

定義

交互の行で使用される背景ブラシを取得または設定します。

public:
 property System::Windows::Media::Brush ^ AlternatingRowBackground { System::Windows::Media::Brush ^ get(); void set(System::Windows::Media::Brush ^ value); };
public System.Windows.Media.Brush AlternatingRowBackground { get; set; }
member this.AlternatingRowBackground : System.Windows.Media.Brush with get, set
Public Property AlternatingRowBackground As Brush

プロパティ値

n 番目の行ごとの背景を描画する Brush。n は AlternationCount プロパティによって定義されます。 登録済みの既定値は null です。 この値が何に影響されるかの詳細については、DependencyProperty のトピックを参照してください。

次の例は、 で行の背景色を交互に設定する方法を DataGrid示しています。

<DataGrid x:Name="CustomerGrid" ItemsSource="{Binding}" AlternatingRowBackground="LightBlue" AlternationCount="2" />

次の図は、このコードが実行時にどのように表示されるかを示しています。

行の背景の 3 つの交互の色 行

注釈

RowBackground、および AlternationCount の各プロパティによってAlternatingRowBackground、各行の背景の外観が決まります。

が 2 未満の場合 AlternationCount 、プロパティを AlternatingRowBackground 2 に設定 AlternationCount します。

適用対象

こちらもご覧ください