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
320
Add/Remove columns
posted

Hi Guys,

I was wondering wich event fires when add/remove a column from a xamDataGrid. I'm trying to get a LabelPresenter object after a column has been added with VisualTreeHelper.GetChild(pParent, pIndex),but I'm getting the wrong object. Any idea?

Best,

Pablo

Parents
No Data
Reply
  • 6365
    Offline posted

    Hello Pablo,

     

    Thank you for choosing Infragistics.

     

    I have been looking into your issue and I have prepared a sample application for you to test and see if the desired effect is achieved.

     

    I have created an instance of the XamDataGrid and I have bound a sample collection to its DataSource property. I have defined a Style in the XamDataGrid's resources that targets the LabelPresenter and I have created an EventSetter for the Loaded event of the LabelPresenter. This way you should be able to get and customize the LabelPresenter for each field as soon as the presenter has loaded. I have also created a button which I have used as an example to create a new Field with a BindingType property set to Unbound and add it to the initial FieldLayout's Fields collection. When the field has been successfully added, the Loaded event of the LabelPresenter is fired again and it's Background property is also set to Red.

     

    After a field has been added to a FieldLayout's Fields collection, in order to initialize the cell values of the field for each record respectively, an approach I can suggest you is to use the InitializeRecord event of the XamDataGrid.

     

    If you require any further assistance on this matter, please do not hesitate to ask.

    XamDataGrid_labelPresenter.zip
Children