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
80
XamDataChart Axis Visibility
posted

Hello. I'm using Ultimate edition complect of your UI elements. I'm trying create a chart that have 2 possible state. First state have one Y axis and one ScatterLineSerie. Second state have two axis and two ScatterLineSerie (this state shown on the picture). All states a build on the same axis(Time). Values of Max, Min, Color and Visibility of axis are binded to the properties in VM. Axis of first  state and one of the axis of second state positinated at the left.

Problem that after binding (and not only binding, even if manual set) axis that must be Collapsed are not collapsed (shown on the picture with red rectangle). At the same time Axis stroke are not visible.

Kind regards,

Alexey

Parents
  • 1400
    Offline posted
    Hello Alexey,
    Properties of axes will update only if they are bound to properties of object that implements INotifyPropertyChanged interface and if the notifications about changes to these properties are sent using the OnPropertyChanged() method:
    public class AxisSettings : ObservableModel
        {
            public AxisSettings()
            {
                this.Visibility = Visibility.Visible;
            }
    
            private Visibility _visibility;
            public Visibility Visibility
            {
                get { return _visibility; }
                set { if (_visibility == value) return; _visibility = value; OnPropertyChanged("Visibility"); }
            }
        }
        public abstract class ObservableModel : INotifyPropertyChanged
        {
            #region INotifyPropertyChanged  
            public event PropertyChangedEventHandler PropertyChanged;
            protected void OnPropertyChanged(string propertyName)
            {
                PropertyChangedEventHandler handler = this.PropertyChanged;
                if (handler != null)
                    handler(this, new PropertyChangedEventArgs(propertyName));
            }
            public void OnAsyncPropertyChanged(string propertyName)
            {
                if (PropertyChanged != null)
                {
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
                    });
                }
            }
            #endregion
        }
    

     

     

     

    I attached a sample application that changes visibility of axes as you specified it in your post.

    Let me know if you have more questions about this.
    AxisPropertyBinding.zip
Reply Children