Silverlight 2.0 Beta 1 Gridsplitter Bug

Monday, 17 March 2008 13:45 by slanford

There is a bug in Silverlight 2.0 Beta 1 which causes the browser to crash when you attempt to move a Gridsplitter with ShowPreview="True" and is defined in a Grid without explicitly defining both row(s) and column(s). One solution is to simply set ShowPreview="False". However, the best solution is to simply make sure that you have explicitly defined the row(s) and columns(s) for your Grid. Below are examples that illustrate the problem and solution.

<!-- This will crash because no explicit row is defined-->

<Grid Background="White" Width="200">

    <Grid.ColumnDefinitions>

        <ColumnDefinition Width="*" />

        <ColumnDefinition Width="Auto" />

        <ColumnDefinition Width="*" />

    </Grid.ColumnDefinitions>

 

    <GridSplitter Grid.Column="1"

                  HorizontalAlignment="Center"

                  VerticalAlignment="Stretch"

                  ShowsPreview="True"

                  Background="Black"

                  Width="2"/>

</Grid>

 

<!-- This will work because ShowPreview is set to False -->

<Grid Background="White" Width="200">

    <Grid.ColumnDefinitions>

        <ColumnDefinition Width="*" />

        <ColumnDefinition Width="Auto" />

        <ColumnDefinition Width="*" />

    </Grid.ColumnDefinitions>

 

    <GridSplitter Grid.Column="1"

                  HorizontalAlignment="Center"

                  VerticalAlignment="Stretch"

                  ShowsPreview="False"

                  Background="Black"

                  Width="2"/>

</Grid>

 

<!-- This will work because row/columns are defined explicitly -->

<Grid Background="White" Width="200">

    <Grid.RowDefinitions>

        <RowDefinition Height="*" />

    </Grid.RowDefinitions>

 

    <Grid.ColumnDefinitions>

        <ColumnDefinition Width="*" />

        <ColumnDefinition Width="Auto" />

        <ColumnDefinition Width="*" />

    </Grid.ColumnDefinitions>

 

    <GridSplitter Grid.Column="1"

                  HorizontalAlignment="Center"

                  VerticalAlignment="Stretch"

                  ShowsPreview="True"

                  Background="Black"

                  Width="2"/>

</Grid>




 
Categories:   Silverlight 2.0
Actions:   E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed