Bohn
Bohn

Reputation: 26919

Moving a property to a separate class

On creating a new custom control derived I have something like this:

[Category("Appearance")]
public Color SeparatorColor
{
    get { return separatorColor; }
    set { separatorColor= value; }
}

and List View its self also has a ListViewInsertionMark class but I can't use it just because it doesn't work when VisualStyles are turned off and sadly in my app they should be turned off.

So right now I have something like that in my main class that is deriving from List View and it works fine. But I was thinking if I can make it a little more similar to .NET's class that I can't use. So moving it to a separate class, etc... What do you recommend? keeping it as it is inside the main class? moving it to a separate class? Good design? bad design?

Upvotes: 1

Views: 85

Answers (1)

Erez Robinson
Erez Robinson

Reputation: 784

ListViewInsertionMark is basically used to point the drop position.
If all you need are seperators between list items, then yes, you need to derive from ListView.

Add this SeperatorColor property (you can use an autoproperty here). Override OnPaint, and draw the seperators one by one and don't forget to call base.OnPaint
Cheers.

Upvotes: 1

Related Questions