Click here to Skip to main content
15,743,429 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I've written a custom ToolTip Class, that has multiple Settings which were contained in a seperate class called ToolTipInfo.

I've managed to make them all Displayed in the Designer and all value changes were saved, except of my
Collection<bool> CheckerStates

I can add new Items or remove them, that works, but when I change their value from false to true and click OK their values were reset to false.

So here's my Code for the ToolTipInfo Class:

using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;

namespace MetroUI.Components
    public partial class MetroToolTip
        public class TooltipInfo 
            #region Properties

            public string Text { get; set; }

            [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), EditorBrowsable(EditorBrowsableState.Advanced), TypeConverter(typeof(StringConverter))]
            public StringCollection LabelTexts { get; set; }

            [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), EditorBrowsable(EditorBrowsableState.Advanced), TypeConverter(typeof( CollectionConverter))]
            public Collection<bool> CheckerStates { get; set; }

            [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), EditorBrowsable(EditorBrowsableState.Advanced)]
            public bool Empty
                get => (string.IsNullOrWhiteSpace(this.Text) && this.LabelTexts.Count == 0 && this.CheckerStates.Count == 0);

            [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), EditorBrowsable(EditorBrowsableState.Advanced)]
            public bool Enabled { get; set; }


            public TooltipInfo() 
                this.LabelTexts = new();
                this.CheckerStates = new();

                Enabled = true;


What I have tried:

I've tried to set the
but it didn't help...

I also tested if it behaves differently when I move the Property to the Component Class, but it behaves the same

And searching on the web didn't gave me usefull threads either...

Now I've tried the same Classes with VisualBasic(.net Framework) and there it worked fine...

So it seems it's a problem generated by .net Core...

But I have no idea how to solve that.
Updated 14-Jan-22 17:56pm
Luc Pattyn 26-Dec-21 21:34pm    
I have zero experience with this. However I would try TypeConverter(typeof(BooleanConverter)) for CheckerStates

If TypeConverter(typeof(StringConverter)) works for a StringCollection, I would expect a BooleanConverter to work for a Collection[bool>
Electro_Attacks 27-Dec-21 21:50pm    
Well, that doesn't work as well...
The Designer doesn't show the Collection anymore, instead it shows a value selector of true/ false....
0x01AA 28-Dec-21 10:38am    
Works for me for .net 4.7. Now I'm waiting for vs2019 update (1.4GB) to try it with 5.0 ;)
0x01AA 28-Dec-21 11:33am    
Just made a minimal test from scratch with .NET 5.0.

namespace WinFormsControlLibrary1
public partial class UserControl1 : UserControl
public UserControl1()

this.CheckerStates = new();

[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), EditorBrowsable(EditorBrowsableState.Advanced), TypeConverter(typeof(CollectionConverter))] public Collection<bool> CheckerStates { get; set; }

Put that control on a form, added some values, changed some of them to 'true', pressed 'OK' after open collection editor again, I see the expected values.

The CheckerStates do work fine for me with .NET 5.0. Btw. Culture on '(none)'
Electro_Attacks 28-Dec-21 13:37pm    
It kinda works now too, but somehow all my custom Components doesn't show up in the Toolbox anymore...

1 solution

Ok guys, I've managed to get my code working, somehow... It's not tested completely, but it looks promising to me :)

If you find any errors doing testing, or any suggestions how I can improve my code, let me know...
You might need to comment out parts that will result to an build error, those parts were implementations of my custom control Library..

And please keep in mind, that I've never studied programming and learned all my skills by my own... xD

So anyways, the source files would be too large for posting them into this Solution, so I will share all important files via my Google Drive...

I'm looking forward to hear your first impressions...

Source Link: Shared Code – Google Drive[^]
Share this answer
Maciej Los 31-Jan-22 11:52am    
My 5!
Electro_Attacks 1-Feb-22 11:57am    
I'm sorry, didn't understood that one :D
Maciej Los 1-Feb-22 15:58pm    
Your answer has been uovoted by me and you reputation growed up 😀
Take a look at the stars on the right top corner.
Electro_Attacks 2-Feb-22 14:19pm    
So you tested my files? :D
Maciej Los 2-Feb-22 15:59pm    
No. But i believe that these files might help other persons to resolve their issues.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900