This is a migrated thread and some comments may be shown as answers.

Binding error when using MVVM in RadDiagramShape

1 Answer 167 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 2
Iron
Iron
Veteran
Peter asked on 13 Apr 2021, 06:32 AM

Hello,

I am using MVVM in RadDiagram.

I am facing a binding error when using style bindings to apply bindings on the RadDiagramShape properties. The binding works, but the error is a little bit anoying.

This is my XAML:

<Style TargetType="telerik:RadDiagramShape" BasedOn="{StaticResource RadDiagramShapeStyle}">
    <Setter Property="Background">
        <Setter.Value>
            <LinearGradientBrush>
                <LinearGradientBrush.GradientStops>
                    <GradientStop Offset="0" Color="{Binding BkgrdGradientColor1}" />
                    <GradientStop Offset="1" Color="{Binding BkgrdGradientColor2}" />
                </LinearGradientBrush.GradientStops>
            </LinearGradientBrush>
        </Setter.Value>
    </Setter>

 

This is the binding error:

Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=BkgrdGradientColor1; DataItem=null; target element is 'GradientStop' (HashCode=57039000); target property is 'Color' (type 'Color')

Can you help me with that?

regards,

Tobias

1 Answer, 1 is accepted

Sort by
0
Peter
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 14 Apr 2021, 09:45 AM

Hello,

I solved the issue by using a ShapeStyleSelector and setting all colors in XAML.

regards,

Tobias

Tags
Diagram
Asked by
Peter
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Peter
Top achievements
Rank 2
Iron
Iron
Veteran
Share this question
or