It is possible to synchronize axes if you bind the VisibleRange of an Axis to a property of type IRange in the ViewModel. So if I have 2 charts I can bind them to the same IRange and they get synchronized. This works fine. Now I want to be able to activate or deactivate this behavior. I did something like this, but it is not working:
<s:SciChartSurface.YAxis>
<s:NumericAxis>
<s:NumericAxis.Style>
<Style TargetType="s:NumericAxis">
<Style.Triggers>
<DataTrigger Binding="{Binding SyncYaxes}" Value="True">
<Setter Property="VisibleRange" Value="{Binding
SyncSharedYrange, Mode=TwoWay}"/>
</DataTrigger>
<DataTrigger Binding="{Binding SyncYaxes}" Value="False">
<Setter Property="VisibleRange" Value="{x:Null}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</s:NumericAxis.Style>
</s:NumericAxis>
</s:SciChartSurface.YAxis>
After implemented these triggers, it stops working, it does not matter if the property SyncYaxes is true or false. If I set the binding without triggers, both axes are sync as expected, but I cannot stop this behavior if I want. What do you think ? How can this be done ?
This did not work in XAML but I solved it in the ViewModel by binding each chart to a IRange and Then if they should be synchronized, every time one of the IRange changes, then the other gets updated by handling PropertyChanged (Only if SyncYAxes is true).