在C#Windows应用程序中填充Listview

在C#Windows应用程序中填充Listview

问题描述:

在数据库性别中按位存储.我想填充listview,所以我不想将性别显示为位字段,而是希望将其显示为男性或女性.

In database gender store as bit. I want to fill listview,so that instead of showing gender as bit field i want to show it as male or female

不计算.
您为什么要在某栏中填写某人的性别?
您怎么知道他们的性别?
你问过他们吗?
而如果性别发生变化,或者是中性的,该怎么办?
我认为您没有考虑到这一点.


我能理解的性别"字段,男女不限,因为某人的性别是恒定的,除非进行手术.

性别更难评估.
男性或女性,很难分辨,而且主观性很高.

一个男人可能有女人味,但是感觉好像他是男性,您将如何处理?
Does not compute.
Why would you want to fill a column with someones gender?
How do you you know their gender?
Have you asked them?
And what if the gender changes, or is neuter?
I don''t think you have thought this through.


The field "Sex" I can understand, and Male or Female is fine, for someones sex is constant, barring surgery.

Gender is much more difficult to assess.
Masculine or Feminine, it can be hard to tell, and is highly subjective.

A man may be feminine, but feel as though he is masculine, how would you deal with that?


这应该不太困难.实际上有许多选项可以实现.

一种方法是简单地将绑定集合中的所有0和1都设置为适当的标记(男性或女性),然后将集合作为数据源附加到ListBox.
It should not be too difficult. There are a number of options to do this actually.

One way is to simply set set all 0 and 1''s in the binding collection to the appropriate tags (male or female) and then attach the collection to the ListBox as the Datasource.


那么为什么要使用ListView来做到这一点?
我认为还有更好的选择,例如将这些值绑定到单选按钮甚至是下拉列表中.
well why are you using ListView to do that?
I think there are better options like binding those values in radio button or even a dropdown list.