Page 1 of 1

ListView won't clip

Posted: 07 Aug 2017, 14:55
by AndreasEnscape
Hi all,
I have tried everything from canvs to Border with ClipToBounds set tro True, bu I cannot get ListView to NOT draw text, Images, anything, exceeding or covering all top and bottom. Any help welcome, here is the small code snippet. Viewtexture and ViewName are methods returning an image and a string, respectively.
        <ListView ClipToBounds="True" Visibility="{Binding ElementName=ExpanderControl, Converter={StaticResource convBoolVis}, Path=IsChecked}" Name="ViewsList" ItemsSource="{Binding Path=ViewListAccessor, Mode=OneWay}" Foreground="White" Background="Gray">
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="Thumbnail">
                        <GridViewColumn.CellTemplate >
                            <DataTemplate>
                                <StackPanel Orientation="Vertical" Width="{Binding ActualWidth, ElementName=ImgCell}" Height="{Binding ActualHeight, ElementName=ImgCell}" >
                                    <Image Source="{Binding Path=ViewTexture}" MaxHeight="240" MaxWidth="240"/>
                                    <TextBlock Text="{Binding ViewName}" HorizontalAlignment="Center" Margin="2,2,2,2" ClipToBounds="True"/>
                                </StackPanel>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                </GridView>
            </ListView.View>
        </ListView>
        

Re: ListView won't clip

Posted: 16 Aug 2017, 11:55
by sfernandez
We had a bug related to list clipping that was fixed for the upcoming release 2.0.3.
It was happening if in a list with few items (without scroll required) then items when are added to the source collection so the list needed to enable scroll and clipping.