ListView控件动态在WPF环境中添加或隐藏列 [英] The listview control dynamci add or hide a column in WPF environment

查看:404
本文介绍了ListView控件动态在WPF环境中添加或隐藏列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

请告诉我答案,

谢谢,
我的名字是Brock.liu

Hi,everybody

Please tell me answer,

Thanks,
My name is Brock.liu

推荐答案

您可以使用XAML进行的所有工作都可以通过C#完成.若要隐藏列,请将其Width属性设置为0.要添加列,可以预先添加并隐藏它,然后稍后将其取消隐藏,也可以通过C#代码添加它.请注意,您可以给GridViewColumns一个x:Name,然后使用该名称从C#引用它们.您还可以命名包含GridViewColumnCollection的GridView(在XAML中称为GridView.ColumnCollection),然后访问Columns属性以访问每一列(或使用C#添加新列).

Everything you can do from XAML you can do from C#. To hide a column, set its Width property to 0. To add a column, you can either add it in advance and hide it then later unhide it, or you can add it through C# code. Note that you can give GridViewColumns an x:Name then reference them from C# using that name. You can also name the GridView that contains the GridViewColumnCollection (in XAML it''s known as the GridView.ColumnCollection) and then access the Columns property to visit each column (or add a new column using C#).

写道:​​

我叫Brock.liu

My name is Brock.liu



没有冒犯,但没人在乎你的名字.



No offense, but nobody cares what your name is.

写道:​​

请告诉我答案



也许您只是彬彬有礼,但是您却变得很急躁.显然,我们是在这里回答您的问题,因此无需要求我们这样做.只是另一个友善的小贴士.



Maybe you are just being polite, but you are coming off as pushy. Obviously we are here to answer your question, so there is no need to request we do so. Just another friendly tip.


不要理会叫你发脾气的人.我不认为他读过有人告诉你他们不在乎你的名字的地方,而你回答请告诉我答案".
Ignore the person who called you pushy. I don''t think he read where someone told you they don''t care about your name and you replied with "please tell me answer".


这篇关于ListView控件动态在WPF环境中添加或隐藏列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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