title: How to handle event for nonvisual objects in Flex
body: <p>I am trying to perform two way binding e.g I have a button (out of many controls), on its selection, I am showing the values of its diff properties(like height, width etc) in some textinput. This one way process works fine.</p>
  
  <p>But the reverse process doesn't work. i.e When I select some button, and try to change its dimension by entering some value in height, width textinputs, the dimension are not changed.</p>
  
  <p>How to know which button was selected by me? How events needs to be handled here ?</p>
  
  <hr>
  
  <pre><code>private void Form1_Load(object sender, System.EventArgs e)
          {
              //Create some data and bind it to the grid
              dt1 = GetData(1000, 3);
              this.UltraGrid1.DataSource = dt1;
              //Set the grid's CreationFilter to a new instance of the NumbersInRowSelectors class. 
              this.UltraGrid1.CreationFilter = new NumbersInRowSelectors();           
          }
  
          private void UltraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
          {       
              //Hide the default images that are drawn in the RowSelectors, like the pencil and asterisk, etc. 
              e.Layout.Override.RowSelectorAppearance.ImageAlpha = Infragistics.Win.Alpha.Transparent;
  
              //Center the text in the RowSelectors.
              e.Layout.Override.RowSelectorAppearance.TextHAlign = Infragistics.Win.HAlign.Center;
              e.Layout.Override.RowSelectorAppearance.TextVAlign = Infragistics.Win.VAlign.Middle;           
  
              //There is no wy to change the width of the RowSelectors.
              //Use a smaller font, so that 3-digit numbers will fit. 
              e.Layout.Override.RowSelectorAppearance.FontData.Name = "Small Fonts";
              e.Layout.Override.RowSelectorAppearance.FontData.SizeInPoints = 6;
          }
  
          //The NumbersInRowSelectors class. This class Implements a CreationFilter and
          //adds a TextUIElement to each RowSelector which displays the row number of
          //the row.
          public class NumbersInRowSelectors:Infragistics.Win.IUIElementCreationFilter
          {
  
              #region Implementation of IUIElementCreationFilter
              public void AfterCreateChildElements(Infragistics.Win.UIElement parent)
              {
                  //Don't need to do anything here
              }
              public bool BeforeCreateChildElements(Infragistics.Win.UIElement parent)
              {
                  //Declare some variables
                  Infragistics.Win.TextUIElement objTextUIElement;
                  Infragistics.Win.UltraWinGrid.RowSelectorUIElement objRowSelectorUIElement;
                  Infragistics.Win.UltraWinGrid.UltraGridRow objRow;
                  int RowNumber;
  
                  //Check to see if the parent is a RowSelectorUIElement. If not, 
                  //we don't need to do anything
                  if (parent is Infragistics.Win.UltraWinGrid.RowSelectorUIElement)
                  {
                      //Get the Row from the RowSelectorsUIElement
                      objRowSelectorUIElement = (Infragistics.Win.UltraWinGrid.RowSelectorUIElement)parent;
                      objRow = (Infragistics.Win.UltraWinGrid.UltraGridRow)objRowSelectorUIElement.GetContext(typeof(Infragistics.Win.UltraWinGrid.UltraGridRow));
  
                      //Get the Index of the Row, so we can use it as a row number. 
                      RowNumber = objRow.Index;
  
                      //Check to see if the TextUIElement is already created. Since
                      //The RowSelectorsUIElement never has children by default, we
                      //can just check the count. 
                      if (parent.ChildElements.Count == 0)
                      {
                          //Create a new TextUIElement and parent it to the RowSelectorUIElement
                          objTextUIElement = new Infragistics.Win.TextUIElement(parent, RowNumber.ToString());
                          parent.ChildElements.Add(objTextUIElement);
                      }
                      else
                      {
                          //There's already a TextUIElement here, so just set the Text
                          objTextUIElement = (Infragistics.Win.TextUIElement)parent.ChildElements[0];
                          objTextUIElement.Text = RowNumber.ToString();
                      }
                      //Position the TextUIElement into the RowSelectorUIElement
                      objTextUIElement.Rect = parent.RectInsideBorders;
  
                      //Return True let the grid know we handled this event. 
                      //This doesn't really do anything, since the grid
                      //does not create any child elements for this object, anyway.
                      return true;
                  }
  
                  //Return false to let the grid know we did not handle the event. 
                  //This doesn't really do anything, since the grid
                  //does not create any child elements for this object, anyway.
                  return false;               
              }       
              #endregion
          }
  
      }
  </code></pre>