WPF的ListView除去产生额外的列 [英] WPF listview remove extra column generated

查看:483
本文介绍了WPF的ListView除去产生额外的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在WPF使用一个ListView它总是产生在ListView中的最后一个额外的列。例如,如果我在列表视图定义两列,当我运行它,它产生的两列加一空列标题。任何想法我怎么能删除?

When I use a ListView in WPF it always generates one extra column at the end of the ListView. For example, if I define two columns in my listview and when I run it it generates those two columns plus one empty column header. Any idea how I can remove that?

样的ListView的XAML

Sample ListView XAML

<ListView ItemsSource="{Binding Path=SearchAttributes}"
                      DockPanel.Dock="Top">
                <ListView.View>
                    <GridView x:Name="grdView">
                        <GridViewColumn Header="Name" DisplayMemberBinding="{Binding SearchFieldName}" />
                        <GridViewColumn Header="Balance" Width="Auto"
                                        CellTemplateSelector="{StaticResource searchFilterDataTemplateSelector}"
                                        >
                        </GridViewColumn>
                    </GridView>
                </ListView.View>
            </ListView>

谢谢,
Jithu

Thanks, Jithu

推荐答案

的最后一列被简单地需要大小的遗留空间列,使其符合恰好在该空间。通过定义的宽度为您确保只有尽可能大汽​​车。

The last column is simply the left over space you need to size the columns to fit exactly in the space. By defining the width as Auto you are making sure that is only as big as possible.

这篇关于WPF的ListView除去产生额外的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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