Sdílet prostřednictvím


DataGrid.VerticalGridLinesBrush Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the Brush that is used to paint grid lines separating columns.

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls.Data (in System.Windows.Controls.Data.dll)

Syntax

'Declaration
Public Property VerticalGridLinesBrush As Brush
public Brush VerticalGridLinesBrush { get; set; }
<sdk:DataGrid>
  <sdk:DataGrid.VerticalGridLinesBrush>
    singleBrush
  </sdk:DataGrid.VerticalGridLinesBrush>
</sdk:DataGrid>
<sdk:DataGrid VerticalGridLinesBrush="colorString"/>

XAML Values

  • singleBrush
    Within opening and closing property elements for sdk:DataGrid.VerticalGridLinesBrush, exactly one object element for an object that derives from Brush. The object element is typically one of the following Silverlight classes: LinearGradientBrush, RadialGradientBrush, ImageBrush, SolidColorBrush, or VideoBrush.

  • colorString
    The Color for a SolidColorBrush expressed as an attribute string. This can be a named color, an RGB value, or an ScRGB value. RGB or ScRGB may also specify alpha information. See Color.

Property Value

Type: System.Windows.Media.Brush
The brush that is used to paint vertical grid lines. The default is a SolidColorBrush with a Color value of opaque grey (ARGB value #FFDFE3E6).

Remarks

Dependency property identifier field: VerticalGridlinesBrushProperty()

This property has no effect if the GridLinesVisibility property is set to Horizontal or None.

Examples

The following code example demonstrates how to set VerticalGridLinesBrush property in code. This example is part of a larger example available in the Walkthrough: Customizing the DataGrid Control Using Properties topic.

Private Sub cbCustomGridLineVert_Changed(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
    Dim cb As CheckBox = sender
    If Me.dataGrid1 IsNot Nothing Then
        If cb.IsChecked = True Then
            Me.dataGrid1.VerticalGridLinesBrush = New SolidColorBrush(Colors.Blue)
        ElseIf cb.IsChecked = False Then
            Me.dataGrid1.VerticalGridLinesBrush = New SolidColorBrush(Color.FromArgb(255, 223, 227, 230))
        End If
    End If
End Sub
private void cbCustomGridLineVert_Changed(object sender, RoutedEventArgs e)
{
    CheckBox cb = sender as CheckBox;
    if (this.dataGrid1 != null)
    {
        if (cb.IsChecked == true)
            this.dataGrid1.VerticalGridLinesBrush = new SolidColorBrush(Colors.Blue);
        else 
            this.dataGrid1.VerticalGridLinesBrush = new SolidColorBrush(Color.FromArgb(255, 223, 227, 230));
    }
}

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

See Also

Reference

Other Resources