views:

643

answers:

2

Silverlight 3;

I have a ValidationSummary in the top row of my grid. When the ValidationSummary appears, it pushes my button row (row 3) off the bottom of the displayable screen.

<Grid HorizontalAlignment="Stretch"
          VerticalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="36" />
        </Grid.RowDefinitions>

        <di:ValidationSummary Grid.Row="0" />

        <Grid x:Name="gridOuterContentHolder"
              Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="0.68*" />
                <RowDefinition Height="5" />
                <RowDefinition Height="0.32*" />
            </Grid.RowDefinitions>
<!-- elements removed for brevity -->

        </Grid>

        <StackPanel x:Name="stack"
                    Grid.Row="2"
                    Orientation="Horizontal"
                    HorizontalAlignment="Right">
            <Button Content="Delete"
                    x:Name="btnDelete"
                    Height="20"
                    Width="75" />

        </StackPanel>
    </Grid>

I'm a code monkey not a pixel pusher and can't figure out which combination of Stretch's, Auto's and *'s I need. Any pushers out there that can help??

Thanks, Mark

A: 

I am also facing same issue. Please help

harsha
A: 

I was able to do this by making the validationsummary control a child of scrollview with a maxheight set. This limits the ability of the validationsummary to stretch beyond its parent's maxheight.

Because by default, validationsummary controls use a getparent() to determine the control they are validating, this requires you to manually override the target when the appication innitializes (in vb I do it in the new() routine of my page class.

MyValidationSummary.Target = TheNewGrid

You probably don't want to see the scrollviewer when there are no errors, so set it to Collapsed and in the make it visible only with the validationsummary has errors:

    Private Sub MyValidationSummary_LayoutUpdated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyValidationSummary.LayoutUpdated
    If MyValidationSummary.HasErrors Then
        svMyValidationSummary.Visibility = Windows.Visibility.Visible
    Else
        svMyValidationSummary.Visibility = Windows.Visibility.Collapsed
    End If
End Sub

I can't seem to get this editor to not screw up the xaml, here's a link: example

pug2694328