Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
XamDataChart Multiple Binding errors when creating Y axes in code behind
posted

Hi

I'm having an issue since I updated to 18.2 (was priori to 17.2)

I create Y axes in code behind :



  yAxis = new NumericYAxis();
                yAxis.Title = IdYAxis;

                yAxis.Tag = IdYAxis;

                AxisLabelSettings setaxlab = new AxisLabelSettings();
                switch (PositionYaxis)
                {
                    case ePositionYAxis.IN_LEFT: setaxlab.Location = AxisLabelsLocation.InsideLeft; break;
                    case ePositionYAxis.OUT_LEFT: setaxlab.Location = AxisLabelsLocation.OutsideLeft; break;
                    case ePositionYAxis.IN_RIGHT: setaxlab.Location = AxisLabelsLocation.InsideRight; break;
                    case ePositionYAxis.OUT_RIGHT: setaxlab.Location = AxisLabelsLocation.OutsideRight; break;
                }
                setaxlab.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(couleurAxis));

                yAxis.LabelSettings = setaxlab;
                
                yAxis.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(couleurAxis));


     

               TitleSettings titleset =(TitleSettings) YNumericAxisbase.TitleSettings.Clone();
                titleset.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(couleurAxis));
                titleset.Angle = 270;


                yAxis.TitleSettings = titleset;



                yAxis.MajorStrokeDashArray = new DoubleCollection(new double[] { 1, 7 });
                yAxis.MajorStroke = new SolidColorBrush((Color)ColorConverter.ConvertFromString(couleurAxis));

                yAxis.MinimumValue = Miny;
                yAxis.MaximumValue = MaxY;


     
                _owner.Axes.Add(yAxis);

But I now have multiple Binding errors  when I run the software :

System.Windows.Data Error: 40 : BindingExpression path error: 'Effect' property not found on 'object' ''AnalysePatientViewModel' (HashCode=38220454)'. BindingExpression:Path=Effect; DataItem='AnalysePatientViewModel' (HashCode=38220454); target element is 'TextBlock' (Name=''); target property is 'Effect' (type 'Effect')
System.Windows.Data Error: 40 : BindingExpression path error: 'Foreground' property not found on 'object' ''AnalysePatientViewModel' (HashCode=38220454)'. BindingExpression:Path=Foreground; DataItem='AnalysePatientViewModel' (HashCode=38220454); target element is 'TextBlock' (Name=''); target property is 'Foreground' (type 'Brush')
System.Windows.Data Error: 40 : BindingExpression path error: 'FontFamily' property not found on 'object' ''AnalysePatientViewModel' (HashCode=38220454)'. BindingExpression:Path=FontFamily; DataItem='AnalysePatientViewModel' (HashCode=38220454); target element is 'TextBlock' (Name=''); target property is 'FontFamily' (type 'FontFamily')
System.Windows.Data Error: 40 : BindingExpression path error: 'FontSize' property not found on 'object' ''AnalysePatientViewModel' (HashCode=38220454)'. BindingExpression:Path=FontSize; DataItem='AnalysePatientViewModel' (HashCode=38220454); target element is 'TextBlock' (Name=''); target property is 'FontSize' (type 'Double')
System.Windows.Data Error: 40 : BindingExpression path error: 'FontStretch' property not found on 'object' ''AnalysePatientViewModel' (HashCode=38220454)'. BindingExpression:Path=FontStretch; DataItem='AnalysePatientViewModel' (HashCode=38220454); target element is 'TextBlock' (Name=''); target property is 'FontStretch' (type 'FontStretch')
System.Windows.Data Error: 40 : BindingExpression path error: 'FontStyle' property not found on 'object' ''AnalysePatientViewModel' (HashCode=38220454)'. BindingExpression:Path=FontStyle; DataItem='AnalysePatientViewModel' (HashCode=38220454); target element is 'TextBlock' (Name=''); target property is 'FontStyle' (type 'FontStyle')
System.Windows.Data Error: 40 : BindingExpression path error: 'FontWeight' property not found on 'object' ''AnalysePatientViewModel' (HashCode=38220454)'. BindingExpression:Path=FontWeight; DataItem='AnalysePatientViewModel' (HashCode=38220454); target element is 'TextBlock' (Name=''); target property is 'FontWeight' (type 'FontWeight')
System.Windows.Data Error: 40 : BindingExpression path error: 'HorizontalAlignment' property not found on 'object' ''AnalysePatientViewModel' (HashCode=38220454)'. BindingExpression:Path=HorizontalAlignment; DataItem='AnalysePatientViewModel' (HashCode=38220454); target element is 'TextBlock' (Name=''); target property is 'HorizontalAlignment' (type 'HorizontalAlignment')
System.Windows.Data Error: 40 : BindingExpression path error: 'IsHitTestVisible' property not found on 'object' ''AnalysePatientViewModel' (HashCode=38220454)'. BindingExpression:Path=IsHitTestVisible; DataItem='AnalysePatientViewModel' (HashCode=38220454); target element is 'TextBlock' (Name=''); target property is 'IsHitTestVisible' (type 'Boolean')
System.Windows.Data Error: 40 : BindingExpression path error: 'OpacityMask' property not found on 'object' ''AnalysePatientViewModel' (HashCode=38220454)'. BindingExpression:Path=OpacityMask; DataItem='AnalysePatientViewModel' (HashCode=38220454); target element is 'TextBlock' (Name=''); target property is 'OpacityMask' (type 'Brush')
System.Windows.Data Error: 40 : BindingExpression path error: 'Opacity' property not found on 'object' ''AnalysePatientViewModel' (HashCode=38220454)'. BindingExpression:Path=Opacity; DataItem='AnalysePatientViewModel' (HashCode=38220454); target element is 'TextBlock' (Name=''); target property is 'Opacity' (type 'Double')
System.Windows.Data Error: 40 : BindingExpression path error: 'Margin' property not found on 'object' ''AnalysePatientViewModel' (HashCode=38220454)'. BindingExpression:Path=Margin; DataItem='AnalysePatientViewModel' (HashCode=38220454); target element is 'TextBlock' (Name=''); target property is 'Padding' (type 'Thickness')
System.Windows.Data Error: 40 : BindingExpression path error: 'VerticalAlignment' property not found on 'object' ''AnalysePatientViewModel' (HashCode=38220454)'. BindingExpression:Path=VerticalAlignment; DataItem='AnalysePatientViewModel' (HashCode=38220454); target element is 'TextBlock' (Name=''); target property is 'VerticalAlignment' (type 'VerticalAlignment')

Those errors are repeated for each Y axe I add in the xamdatachart, I think it has to do with the axis title textblock.

For a reason I don't inderstand the textblock semmes to try to find its values directly on the control Viewmodel ...  I did not have those errors unsing 17.2.

If I create the axes in xaml , I dont have any errors, I tried to compare the objects (xaml created axis vs code created axis) but could not find the cause of this problem.

Thanks in advance