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
240
how to bind?
posted
I tried to bind custom data to XamDatagrid.
My custom data class is follows.

    [DataContract]
    public class AccessAreaDataByGroup : INotifyPropertyChanged
    {
        #region Ctor
        public AccessAreaDataByGroup(int groupNo, string name)
        {
            this.groupNo = groupNo;
            this.name = name;
            this.accdataByRcu = new ObservableCollection<AccessAreaDataByRcu>();
        }
        #endregion

        #region Fields
        private int groupNo;
        private string name;
        private ObservableCollection<AccessAreaDataByRcu> accdataByRcu = null;
        #endregion

        #region Properties
        public int GroupNo
        {
            get { return this.groupNo; }
            set { this.groupNo = value; }
        }

        public string Name
        {
            get { return this.name; }
            set { this.name = value; }
        }

        public ObservableCollection<AccessAreaDataByRcu> AccessDataByRcu
        {
            get { return this.accdataByRcu; }
            set { this.accdataByRcu = value; }
        }
        #endregion

        #region Methods
        
        #endregion

        #region Events
        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged(String info)
        {
            PropertyChangedEventHandler hander = PropertyChanged;

            if (hander != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }
        #endregion

        #region Event Handelr
        
        #endregion
    }

    [DataContract]
    public class AccessAreaDataByRcu : INotifyPropertyChanged
    {
        #region Ctor
        public AccessAreaDataByRcu(int groupNo, int rcuNo)
        {
            this.groupNo = groupNo;
            this.rcuNo = rcuNo;
            this.accdataByDoor = new ObservableCollection<AccessAreaDataByDoor>();
        }
        #endregion

        #region Fields
        private int groupNo;
        private int rcuNo;
        private ObservableCollection<AccessAreaDataByDoor> accdataByDoor = null;
        #endregion

        #region Properties
        public int GroupNo
        {
            get { return this.groupNo; }
            set { this.groupNo = value; }
        }

        public int RcuNo
        {
            get { return this.rcuNo; }
            set { this.rcuNo = value; }
        }

        public ObservableCollection<AccessAreaDataByDoor> AccessDataByDoor
        {
            get { return this.accdataByDoor; }
            set { this.accdataByDoor = value; }
        }
        #endregion

        #region Methods
        
        #endregion

        #region Events
        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged(String info)
        {
            PropertyChangedEventHandler hander = PropertyChanged;

            if (hander != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }
        #endregion

        #region Event Handelr
        
        #endregion
    }

    [DataContract]
    public class AccessAreaDataByDoor : INotifyPropertyChanged
    {
        #region Ctor
        public AccessAreaDataByDoor(int rcuNo, int doorNo)
        {
            this.rcuNo = rcuNo;
            this.doorNo = doorNo;
        }
        #endregion

        #region Fields
        private int rcuNo;
        private int doorNo;
        private bool accessabled = false;
        #endregion

        #region Properties
        public int RcuNo
        {
            get { return this.rcuNo; }
            set { this.rcuNo = value; }
        }

        public int DoorNo
        {
            get { return this.doorNo; }
            set { this.doorNo = value; }
        }

        public bool Accessabled
        {
            get { return this.accessabled; }
            set { this.accessabled = value; }
        }
        #endregion

        #region Methods

        #endregion

        #region Events
        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged(String info)
        {
            PropertyChangedEventHandler hander = PropertyChanged;

            if (hander != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }
        #endregion

        #region Event Handelr

        #endregion
    }

I want to bind AccessAreaDataByGroup collections to XamDataGrid.
The AccessAreaDataByGroup has AccessAreaDataByRcu collection, and the AccessAreaDataByRcu has AccessAreaDataByDoor collection.

My problem is I don't want Heirarchical bind AccessAreaDataByRcu collection and AccessAreaDataByDoor collection.
I want to bind like belows.


                                  Rcu1           Rcu2            Rcu3             Rcu4             Rcu5
Group      Name    door1  door2  doo1  door2  door1  door2   door1  door2   door1  door2
  1            test1      true   false    true  false     true   false      true   false      true   false
  2            test2      true   false    true  false     true   false      true   false      true   false
  3            test3      true   false    true  false     true   false      true   false      true   false
  4            test4      true   false    true  false     true   false      true   false      true   false
  5            test5      true   false    true  false     true   false      true   false      true   false
  6            test6      true   false    true  false     true   false      true   false      true   false
  7            test7      true   false    true  false     true   false      true   false      true   false

how to code in XAML??