StdColorCollection.Count gives System.NullReferenceException

i use Syncfusion.SfScheduler.WPF 28.2.11 nuget package. 

in my xaml file i have 

<syncfusion:ColorPickerPalette

    x:Name="colorPickerPalette"

    Width="100"

    Height="30"/>

with this color pallette i choose a color then save it to db. The color's hex is "#FF95B3D7"

After that when i try to edit color with tis code 

 Brush brush = (Brush)(new BrushConverter().ConvertFrom(service.color));

 colorPickerPalette.SelectedBrush = brush;

i got the error.

if i change the hex code to "#FFFFFF00" from db manually, colorPickerPallette shows the new color without error.


Attachment: Screenshot_20250404_124355_6d6f1080.rar

2 Replies

CY Cem Yasar April 4, 2025 02:43 PM UTC

colorPickerPalette.RecentlyUsedCollection.Clear();

i added this line than resolved.



SS Sekar Sivalingam Syncfusion Team April 4, 2025 06:13 PM UTC

Hi Cem Yasar,

We're glad to hear that the NullReferenceException has been resolved by clearing the RecentlyUsedCollection.

If you have any further questions or need additional assistance, please don't hesitate to reach out. we're happy to help!

Regards,

Sekar Sivalingam


Loader.
Up arrow icon