views:

87

answers:

1

I have a ListView which is using a gridView to display a DataTable and when new rows are added to the DataTable the LsitView grows as expected but when it reaches the bottom of the Canvas it carries on growing.

I want it to stop when it reaches the height of the Canvas, how can Iconfigure this?

The Canvas has a dynamic height which is controlled by the DockPanel it is contained in.

<Canvas>
                <ListView Name="listResults" ItemsSource="{Binding}">
                    <ListView.View>
                        <GridView>
                            <GridViewColumn Header="Request Time" DisplayMemberBinding="{Binding RequestTime}" />
                            <GridViewColumn Header="Request Duration(ms)" DisplayMemberBinding="{Binding Duration}" />
                            <GridViewColumn Header="Request Duration(ms)" DisplayMemberBinding="{Binding Duration}" />
                       </GridView>                            
                    </ListView.View>
                </ListView>
            </Canvas>
+3  A: 

Set the MaxHeight property on your ListView. You could hardcode it, or you could bind it to the ActualHeight property of the canvas.

Muad'Dib