FillColor - not complied with dynamic resource

1 Answer 215 Views
Chart
Daniel
Top achievements
Rank 1
Silver
Bronze
Daniel asked on 14 Apr 2022, 02:46 PM

Hi,

Severity	Code	Description	Project	File	Line	Suppression State

Error	XFC0009	No property, BindableProperty, or event found for "FillColor", or mismatching type between value and property.	AutomationClient.MAUI	D:\Applications\AutomationClient\AutomationClient.MAUI\Views\DashboardView.xaml	204	

FillColor="{DynamicResource PrimaryColor}"- not complied
<Color x:Key="PrimaryColor">#03446a</Color>

 <telerikChart:RadCartesianChart Grid.Row="5" Grid.Column="0" x:Name="totalFilesDividedByRoutesChart" Margin="10" >
                <telerikChart:RadCartesianChart.Palette>
                    <telerikChart:ChartPalette>
                        <telerikChart:ChartPalette.Entries>
                            <telerikChart:PaletteEntry FillColor="{DynamicResource PrimaryColor}" StrokeColor="{DynamicResource PrimaryColor}" />
                        </telerikChart:ChartPalette.Entries>
                    </telerikChart:ChartPalette>
                </telerikChart:RadCartesianChart.Palette>
                <telerikChart:RadCartesianChart.HorizontalAxis>
                    <telerikChart:CategoricalAxis PlotMode="OnTicks"/>
                </telerikChart:RadCartesianChart.HorizontalAxis>
                <telerikChart:RadCartesianChart.VerticalAxis>
                    <telerikChart:NumericalAxis LabelFitMode="MultiLine" LabelFormat="N0"  Minimum="0" />
                </telerikChart:RadCartesianChart.VerticalAxis>
                <telerikChart:RadCartesianChart.Series>
                    <telerikChart:BarSeries ValueBinding="Value"
                                    CategoryBinding="RouteName"
                                    ItemsSource="{Binding TotalFilesDividedByRoutesDataSource}"/>
                </telerikChart:RadCartesianChart.Series>
                <telerikChart:RadCartesianChart.Grid>
                    <telerikChart:CartesianChartGrid StripLinesVisibility="X"
                                       MajorLinesVisibility="XY"
                                       MajorLineColor="LightGray"
                                       MajorLineThickness="3" />
                </telerikChart:RadCartesianChart.Grid>
                <telerikChart:RadCartesianChart.ChartBehaviors>
                    <telerikChart:ChartTooltipBehavior />
                </telerikChart:RadCartesianChart.ChartBehaviors>
            </telerikChart:RadCartesianChart >

1 Answer, 1 is accepted

Sort by
0
Lance | Senior Manager Technical Support
Telerik team
answered on 14 Apr 2022, 03:09 PM

Hello Daniel,

FillColor is not a DependencyProperty, so this exception is expected in .NET. Change it to a StaticResource instead.

To be more specific to what I think you're attempting to do, you cannot dynamically update at runtime after the chart is rendered. This is a situation because of the nature of the native chart controls, they each have different capabilities when it comes to these options and cannot use a dynamically changing property.

If you want to dynamically change the value, you need to instead Remove and Add the PalleteEntry itself from your custom ChartPallete

myPallette.Entries.Clear();

// your newly created pallete entry
var nextEntry = ...;

myPallette.Entries.Add(nextEntry);

If you need to stick to MVVM, you can do this in a custom-built behavior. If you can do this in code-behind  or some code-behind method that will replace the pallete entry as a whole. after this PaletteEntry is updated, you can then re-render the series to adopt the new coloring.

We do not have an example of a custom built-behavior,  you can learn how to do this here https://docs.microsoft.com/en-us/dotnet/maui/fundamentals/behaviors  

Ultimately, at this time, we do not have an official feature that will let you dynamically change FillColor with a DynamicResource. This is a known feature request and is on our backlog.

Regards,
Lance | Manager Technical Support
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Chart
Asked by
Daniel
Top achievements
Rank 1
Silver
Bronze
Answers by
Lance | Senior Manager Technical Support
Telerik team
Share this question
or