0

I have a WinForm application that have GridControl that are bind to a property. The property is of class Type. Something like this:

public class AvailableUpdate
{
    public int Code { get; set; }
    public string Name { get; set; }
    public Type Type { get; set; }
}

My problem is that in the UI it's showing the full Type's name - including the namespace. How do I show only the name, minus the namespace?

For testing sake, I have also tried decorating it with System.ComponentModel.DisplayNameAttribute:

    [DisplayName("aofoej")]
    public Type Type { get; set; }

This doesn't work either...

Farid
  • 872
  • 1
  • 13
  • 30
  • 1
    can you add property `public string TypeName => this.Type?.Name;` to your `AvailableUpdate` class? – vasily.sib Oct 01 '18 at 05:50
  • Yes, and it worked. Never occurred to me to just create another property, that was so simple. – Farid Oct 01 '18 at 06:28
  • 1
    Glad that helps. Btw, there is no special magic in `ComponentModel`s attributes like `DisplayNameAttribute`. They originaly invented for use with WinForm's components and are used by Visual Studio itself. – vasily.sib Oct 01 '18 at 06:31

0 Answers0