GridSplitter.ShowsPreview Property

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

Gets or sets a value that indicates whether the GridSplitter control updates the column or row size as the user drags the control with the mouse.

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


Public Property ShowsPreview As Boolean
public bool ShowsPreview { get; set; }
<sdk:GridSplitter ShowsPreview="bool"/>

Property Value

Type: System.Boolean
true if a preview is displayed; otherwise, false.


Dependency property identifier field: ShowsPreviewProperty

When the ShowsPreview property is set to true, a preview of the change in the row or column sizes is shown. The actual size changes when the GridSplitter is released. If the property is set to false, the column or row sizes are updated in real time as the user drags the GridSplitter control.

When the GridSplitter control is moved with the keyboard, column or row sizes are updated in real time regardless of the ShowsPreview value.


Run this sample

The following XAML creates two GridSplitter controls, one vertical and one horizontal. The horizontal control shows a preview, whereas the vertical one does not.

<!-- NOTE: 
  By convention, the sdk prefix indicates a URI-based XAML namespace declaration 
  for Silverlight SDK client libraries. This namespace declaration is valid for 
  Silverlight 4 only. In Silverlight 3, you must use individual XAML namespace 
  declarations for each CLR assembly and namespace combination outside the scope 
  of the default Silverlight XAML namespace. For more information, see the help 
  topic "Prefixes and Mappings for Silverlight Libraries". 
<UserControl x:Class="GridSplitterExample.Page"
    <Canvas x:Name="LayoutRoot" Background="White" >
        <Grid ShowGridLines="True" Canvas.Top="60" Canvas.Left="20" Width="400" Height="400">
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />

            <TextBlock Text="One!" Grid.Row="0" Grid.Column="0" />
            <TextBlock Text="Two!" Grid.Row="1" Grid.Column="1" />
            <TextBlock Text="Three!" Grid.Row="2" Grid.Column="2" />
            <TextBlock Text="Four!" Grid.Row="3" Grid.Column="3" />
            <sdk:GridSplitter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="4"
                               Height="5" HorizontalAlignment="Stretch" VerticalAlignment="Top"
            <sdk:GridSplitter Grid.Row="2" Grid.Column="1" Grid.RowSpan="2"
                               Width="5" HorizontalAlignment="Left" VerticalAlignment="Stretch"

Version Information


Supported in: 5, 4, 3


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