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
275
Customize the FieldChooser
posted

Hi Infragistics-Team,

I want to overwrite or retemplate the FieldChooser, because I need an extra column where the user can change the column-width.

How can this be done - do you have an example of how to set the itemstemplate?

Best regards

Markus

Parents
No Data
Reply
  • 34810
    Verified Answer
    Offline posted

    Hello Markus,

    Thank you for your post.

    To set the template of the items in the XamDataGrid's FieldChooser, I would first recommend that you navigate to and open the DataPresenterGeneric_Express.xaml file commonly found at the following directory: C:\Program Files (x86)\Infragistics\<your version here>\WPF\DefaultStyles\DataPresenter. Inside of this XAML file, you will find a Style for FieldChooser. This Style will have a DataTemplate targeting the FieldChooserEntry element inside of its Resources collection. This is what you will need from this file, and I would recommend that you pull it into your project.

    Once you have placed this default DataTemplate for FieldChooserEntry into your project, you can modify the contents of the CardPanel inside of that template to include your TextBox that will determine the width of the corresponding Field. The data context of the elements that exist inside of this template will have a reference to the Field in which each item represents, and so you can bind the TextBox's Text property to {Binding Field.Width} to display the width of your Field inside of your textbox.

    I have attached a sample project to demonstrate how this can be achieved. I hope this helps you.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer

    XDGFieldChooserTemplateCase.zip
Children