从显示&QUOT prevent WPF的ListView或列表框,一半"项目 [英] Prevent WPF ListView or ListBox from showing "half" Items

查看:162
本文介绍了从显示&QUOT prevent WPF的ListView或列表框,一半"项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的应用程序,我们有内部网格一些列表视图和列表框,你可以用一个网格分离器的帮助下改变控制的实际高度。
当你这样做能够安排列表框的高度,使该项目中的一个不完全可见的,因为在ListView变短,以显示它。

in our application we have some ListViews and ListBoxes inside grids where you can change the actual height of the control with help of a grid splitter. When doing so you are able to arrange the height of the ListBox so one of the items is not fully visible because the ListView becomes to short to display it.

这是我们不希望的行为。

This is a behavior we don't want.

从我的研究,到目前为止,似乎还没有办法prevent从显示部分项目列表框或ListView但也许有人发现了另一种方式来处理这个问题。也许这个项目可以触发本身无形的,当它只有一半可见。但是,我们如何能找到?

From my research so far it seems there is not way the prevent a ListBox or ListView from showing partial items but maybe someone found another way to deal with this problem. Maybe the item can trigger itself invisible when it is only half visible. But how can we find out?

我们是开放的任何建议。

We are open to any suggestions.

推荐答案

您只需要了minHeight或设置了minWidth到小区这找你调整大小。试试这个:

You just have to set MinHeight or MinWidth to the cell which you'r resizing. Try this:

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition MinHeight="50"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition MinHeight="50"/>
        </Grid.RowDefinitions>
        <ListBox HorizontalAlignment="Center" Margin="10">
            <ListBoxItem>First</ListBoxItem>
            <ListBoxItem>Second</ListBoxItem>
            <ListBoxItem>Third</ListBoxItem>
            <ListBoxItem>Fourth</ListBoxItem>
        </ListBox>
        <GridSplitter Grid.Row="1" Height="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
        <ListView Grid.Row="2" Margin="4">
            <ListViewItem>First</ListViewItem>
            <ListViewItem>Second</ListViewItem>
            <ListViewItem>Third</ListViewItem>
            <ListViewItem>Fourth</ListViewItem>
        </ListView>
    </Grid>

这篇关于从显示&QUOT prevent WPF的ListView或列表框,一半&QUOT;项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆