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
515
Field Chooser problem
posted

Hello,

We are using a xamDataGrid 11.1 in a UserControl. We want to enable users to select the fields that displayed on the screen using the field chooser.

At the beginning, we had a problem because we wanted to add 3 buttons (for configuration save, load and default) under the field list (In the field chooser pop-up). We solved this by creating a separate UserControl containing a FieldChooser control and 3 buttons under it. The constructor of the that UserControl receives a XamDataGrid and set it as the DataPresenter of the FieldChooser.

We are using the new UserControl for several other UserControls in our project. In some of the xamDataGrid, we don't want to show all of the fields in the field chooser so we are using a filer:

private void m_FieldChooser_Loaded(object sender, RoutedEventArgs e)

{

m_FieldChooser.FieldFilters.Clear();

FieldChooserFilter filter;

filter = GetFieldFilet();

m_FieldChooser.FieldFilters.Add(filter);

m_FieldChooser.CurrentFieldGroup = m_FieldChooser.FieldGroups[1];

}

private FieldChooserFilter GetFieldFilet()

{

Predicate<Field> evenFieldFilterCondition = new Predicate<Field>(field => { return (IsFieldVisible(field)); });

FieldChooserFilter filter = new FieldChooserFilter("Fields selection", evenFieldFilterCondition, "");

return filter;

}

private bool IsFieldVisible(Field field)

{

if (m_FieldsToHide != null)

foreach (Field item in m_FieldsToHide)

if (item == field)

return false;

return true;

  • m_FieldsToHide is an ArrayList that contains the field that we don't want to display. 

All of this works fine when we are using it on a one level XamDataGrid (Only 1 field layout). When we are using it on a 2 level grid, we have several issues: 

  1. In case we want to hide some field in both field layouts: We were unable to separate between the groups filers. Aren't we need to make 2 filters? One for each field layout? 
  2. After the filtering, a new group is created. In a one level situation, we are selecting the FieldGroups[1] as the CurrentFieldGroup and hiding the GroupSelector. Is there a solution for the 2 level grid? We want to enable the users to select field from both field layouts. 
  3. Is there a way to change the label of the group name? The default is the name of the source table but we want to set the name on our own.
  4. Is there a way to delete or hide groups? After the filtering, we don't want to enable the users to see the unfiltered groups.
  5.