Home Forums WinForms controls Xceed Grid for WinForms Icon on Column – Based on Condition

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #17020 |

    Hi,

    I am using following custom function to  make the grid on win form.

             public static void AddGridColumn(this GridControl gc, string title, string datacolumn, int width, string formatSpecifier)
            {
                DataBoundColumn col = new DataBoundColumn(datacolumn);
                col.Title = title;
                col.Width = width;
                col.FormatProvider = UtilityLibrary.GetCulture();
                col.FormatSpecifier = formatSpecifier;
                gc.Columns.Add(col);
            }

    I have a boolean column, based on value (t/f) I need to show an icon on the row. if “T” – show icon, if not  blank.

     

    Imported from legacy forums. Posted by bdmsoft (had 1333 views)

    User (Old forums)
    Member
    Post count: 23064

    This can be done by providing a custom CellViewerManager that displays an image instead of a CheckBox for a boolean column.  In fact, we have a topic in the help documentation that shows how to derive for the CellViewerManager class for this specific need.

    http://doc.xceedsoft.com/products/XceedGrid/BooleanImageTextViewer_class.html 

    In this class, you can simply set the FalseImage member to null in the constructor ( e.g. BooleanImageTextViewer.FalseImage = null; ) and set the text to an empty string in the GetTextCore override ( e.g. return string.Empty; ) so only the true icon is displayed, with not text.

    Here is more details on how to work with CellViewerManagers.

    http://doc.xceedsoft.com/products/XceedGrid/Deriving_from_the_CellViewerManager_class.html 

     

    Imported from legacy forums. Posted by André (had 1638 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.