Hi Luca,
Thank you for reaching out. We would like to let you know that we can't directly create a ObservableCollection in XAML. Instead, you can inherit from ObservableCollection<Brush> and add the class in XAML. Define the colors inside the collection and bind that collection to the PaletteBrushes property using a static resource. Please refer to the code snippet below:
public class ChartColorModel : ObservableCollection<Brush> { } |
<chart:SfCartesianChart.Resources> <ResourceDictionary> <local:ChartColorModel x:Key="brush"> <Color>green</Color> <Color>yellow</Color> <Color>red</Color> <Color>blue</Color> <Color>orange</Color> <Color>pink</Color> <Color>violet</Color> </local:ChartColorModel> </ResourceDictionary> </chart:SfCartesianChart.Resources> |
<chart:ColumnSeries ItemsSource="{Binding Data}" XBindingPath="Name" YBindingPath="YValue" TooltipTemplate="{StaticResource template}" EnableTooltip="True" PaletteBrushes="{StaticResource brush}"> </chart:ColumnSeries> |

For more clarification, we have attached the sample for reference.
If you need further assistance or have any concerns, feel free to ask. We're here to help.
Regards,
Nitheesh
Attachment:
PalatteBrushes_4b0f49b1.zip