请问bit类型的性别如何在datagrid里面显示男女
wpf吧
全部回复
仅看楼主
level 5
冷冷_酱 楼主
求指点
2014年05月08日 02点05分 1
level 5
冷冷_酱 楼主
2014年05月08日 02点05分 2
level 7
public class SexConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
try
{
bool tmp = (bool)value;
if (tmp)
return "男";
else
return "女";
}
catch (Exception ex)
{
return value;
}
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Person p = new Person() { name = "张三", sex = false };
lbl2.DataContext = p;
<Label Name="lbl2" Grid.Row="1" Width="200" Height="55" FontSize="25" VerticalAlignment="Top"
Content="{ Binding Path=sex,Converter={StaticResource sexConverter}}"></Label>
2014年05月08日 05点05分 3
静态类转换,很常见的方法
2014年06月28日 03点06分
level 5
冷冷_酱 楼主
@中年谢顶大叔 我想再问问您,wpf导出excel怎么导出,我用的office2010,数据库sql2008,vs2010. 想导出DataGrid表里面的数据。
2014年05月08日 05点05分 4
回复@中年谢顶大叔 :我想问问大叔,button导出按钮里面代码怎么 来自 爱贴吧HD for Windows Phone
2014年05月09日 11点05分
写? 来自 爱贴吧HD for Windows Phone
2014年05月09日 11点05分
我这里有个demo源码。http://kc.cc/Viv4
2014年06月24日 08点06分
level 7
有三种解决方法,第一种就是在读取数据后循环转换下。第二种和第三中就是页面转换。转换有页面调用静态方法,方法直接写转换。第二种就是页面trigger。具体代码我就不写了,可以根据我的思路百度具体使用方法,百度比我更清楚。
2014年06月24日 08点06分 5
1