使用Image时如何防止在列中显示True / False?

问题描述 投票:0回答:1

我想在列中有一个布尔类型的图像。要指定列属性,我使用OLVColumn属性,然后指定ImageAspectName

[OLVColumn("UseK", DisplayIndex = 4, ImageAspectName = "ImageForUseK", CheckBoxes = false, Width = 40)]
public bool UseK
{
    get { return useK; }
    set
    {
        if (useK == value) return;
        useK = value;
        OnPropertyChanged("UseK");
    }
}
protected bool useK = true;

public string ImageForUseK()
{
    return "success";
}

这工作正常并在列中显示图像,但也在图像旁边显示文字“真”。

enter image description here

如何在使用ImageAspectName的同时避免显示布尔属性的字符串值?

objectlistview
1个回答
0
投票

您可以将AspectToStringFormat设置为空格。

© www.soinside.com 2019 - 2024. All rights reserved.