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
2395
Grid column resizing.
posted

Hi,

 

Is there any way to achieve such behavior on XamDataGrid(vol 10.3):

If user resizes the colum, all columns widths  to the left are staying as before resizing and columns to the right are resized.

If user resizes the window which hosts the grid - all columns are resized proportionally.

Thanks.

 

Parents
  • 28407
    Suggested Answer
    posted

    HI Dierk,

     You could wire up the XamDataGrid's FieldLayout's PropertyChanged event.  In this event you could

     modify other fields widths.

     Here is some sample code:

      xamgrid1.FieldLayoutInitializing += new EventHandler<Infragistics.Windows.DataPresenter.Events.FieldLayoutInitializingEventArgs>(xamgrid1_FieldLayoutInitializing);
      void MainWindow_PropertyChanged(object sender, PropertyChangedEventArgs e)
            {
                //throw new NotImplementedException();
           //      MessageBox.Show(e.PropertyName);
                 if (e.PropertyName == "CellWidthResolved")
                 {
                     foreach (Field f in xamgrid1.FieldLayouts[0].Fields)
                     {
                         if (f.Name != "Kids")
                         {
                          
                         
                             xamgrid1.FieldLayouts[1].Fields[f.Name].Settings.LabelWidth = f.LabelWidthResolved;
                             xamgrid1.FieldLayouts[1].Fields[f.Name].Settings.CellWidth = f.CellWidthResolved;
                            
                         }
                     }
                     // xamgrid1.FieldLayouts[0].Fields[0].Width
                 }
            }

    Sincerely,
     Matt
    Developer Support Engineer

     

Reply Children