Won't Fix
Last Updated: 18 Oct 2018 10:23 by ADMIN
Pavel R. Pavlov
Created on: 07 May 2014 11:53
Category: Gauge
Type: Bug Report
Gauge: Binding of GaugeRange's properties does not work as expected
When the properties are bound in code behind, they are not updated as they are supposed to.

Binding them in XAML, by setting the DataContext of the control as StaticResource, works as expected.
1 comment
Posted on: 18 Oct 2018 10:22

After investigation appeared that this is framework behavior of the Freezable objects in WPF. We use Freezable objects in the control in order to inherit the DataContext as explained in the following article:

It works as expected until the DataContext is set after the binging has been evaluated and broken - it won't work anymore.
This is how the issue is reproduced - if the DataContext is set after InitializeComponent - the binding stops working.

As a solution we recommend binding the property through the DataContext of the Gauge instance. For example check the following XAML:

<telerik:RadRadialGauge x:Name="xGauge">
                                Max="{Binding DataContext.Max, ElementName=xGauge}" 
                                Min="{Binding DataContext.Min, ElementName=xGauge}" />

And in code behind the DataContext is set in after InitializeComponent():
public MainWindow()
        this.DataContext = new MyViewModel(20, 80);

I'm changing the Status to Won't Fix - please use the suggested solution. However if this doesn't help - please contact us.