You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The recently used colors are added twice to the ObservableCollection. I saved them and tested it twice, even with the example project. The list then looks like this:
"LastUsedColors": [
{
"Color": "#FFF5F5F5",
"Name": "WhiteSmoke"
},
{
"Color": "#FFF5F5F5",
"Name": "FFF5F5F5"
},
{
"Color": "#FFD3D3D3",
"Name": "LightGray"
},
{
"Color": "#FFD3D3D3",
"Name": "FFD3D3D3"
},
{
"Color": "#FF483D8B",
"Name": "DarkSlateBlue"
},
{
"Color": "#FF483D8B",
"Name": "FF483D8B"
},
{
"Color": "#FF9370DB",
"Name": "MediumPurple"
},
{
"Color": "#FF9370DB",
"Name": "FF9370DB"
},
{
"Color": "#FF8A2BE2",
"Name": "BlueViolet"
},
{
"Color": "#FF8A2BE2",
"Name": "FF8A2BE2"
}
]
}
So as you can see it is always added once with the name and once with the code as name. Maybe the Color should be used to see if it is already inside the list, not the name. I know ColorItem has a nullable Color, but when I pick a color, the method looking into the list if the color is already inside should have a color and if not (null) then it should be ignored and not added.
The text was updated successfully, but these errors were encountered:
Further informations:
When I try to debug in single step, it doesn't happen. It seems it is happening because the Color_SelectionChanged() adds the color with the correct name and afterwards the CloseColorPicker() adds it with the wrong name and the Equals in the ColorItem object tries to equals by Color AND Name. Maybe it should only check by Color?
I tried it and this would work:
public override bool Equals(object obj)
{
ColorItem ci = obj as ColorItem;
if (ci == null)
return false;
return ci.Color.Equals(Color); // && ci.Name.Equals(Name);
}
It would be great if you could submit a Pull Request that fixes this issue. So, I can better understand your fix and apply it in a new version of the control - I'd be more than happy to help 👍🏽 thanx a lot
The recently used colors are added twice to the ObservableCollection. I saved them and tested it twice, even with the example project. The list then looks like this:
"LastUsedColors": [
{
"Color": "#FFF5F5F5",
"Name": "WhiteSmoke"
},
{
"Color": "#FFF5F5F5",
"Name": "FFF5F5F5"
},
{
"Color": "#FFD3D3D3",
"Name": "LightGray"
},
{
"Color": "#FFD3D3D3",
"Name": "FFD3D3D3"
},
{
"Color": "#FF483D8B",
"Name": "DarkSlateBlue"
},
{
"Color": "#FF483D8B",
"Name": "FF483D8B"
},
{
"Color": "#FF9370DB",
"Name": "MediumPurple"
},
{
"Color": "#FF9370DB",
"Name": "FF9370DB"
},
{
"Color": "#FF8A2BE2",
"Name": "BlueViolet"
},
{
"Color": "#FF8A2BE2",
"Name": "FF8A2BE2"
}
]
}
So as you can see it is always added once with the name and once with the code as name. Maybe the Color should be used to see if it is already inside the list, not the name. I know ColorItem has a nullable Color, but when I pick a color, the method looking into the list if the color is already inside should have a color and if not (null) then it should be ignored and not added.
The text was updated successfully, but these errors were encountered: