AnsweredAssumed Answered

Need to populate AFAttributes as Radiobutton in GroupBox and Handle Click event

Question asked by AnimeshK on Nov 16, 2018
Latest reply on Nov 16, 2018 by Dan Fishman

Hi,

 

i am trying to populate RadioButton in Groupbos with list of AF Attributes and Populate listBox with Values on selection of RadioButton

 

I am not able to retrive AFAttribute on click event

 

 

private void afTreeView1_AfterSelect(object sender, TreeViewEventArgs e)

        {

            AFElement selectedElement = afTreeView1.AFSelection as AFElement;

            lbAttributes.Items.Clear();

            if (selectedElement != null)

            {

                int y = 20;

                foreach (AFAttribute ab in selectedElement.Attributes.ToArray<AFAttribute>())

                {

                    RadioButton rb1 = new RadioButton();

                    rb1.Text = ab.Name;

                    rb1.AutoSize = true;

                              rb1.Tag = ab;

                    rb1.Click += new EventHandler(handleClick);

                    gbWeatherFeature.Controls.Add(rb1);

 

 

                    rb1.Location = new Point(10, y);

                    y = y + 20;

                }

            }

        }

 

 

         public void handleClick(object sender, EventArgs e)

            {

             RadioButton rb= sender as RadioButton;

           

             AFAttribute selectedAttribute = sender as AFAttribute;

          

            }

Outcomes