Infragistics Home

Infragistics Forums

Infragistics community online discussions.
Welcome to Infragistics Forums Sign in | FAQ
in Search

What is the Best approach to getting and reapplying Column widths to a grid ?

Last post 07-25-2008 4:27 by dawidgd. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 01-16-2008 16:40

    What is the Best approach to getting and reapplying Column widths to a grid ?

    One of the requirements I have for the Datagrid is to allow the user to resize all the columns to there liking and beable to save off the widths and reapply them when to go back to the page at a later time.

     I figure I can just look through all the Fields in the FieldLayout, and read off the width, but is there an easier way to extract that information and put it back ?

     Thanks

    DK

    • Post Points: 20
  • 01-18-2008 17:04 In reply to

    Re: What is the Best approach to getting and reapplying Column widths to a grid ?

    In the current version, there is no built in mechanism for saving the user customizations but you should submit a suggestion for this feature: http://devcenter.infragistics.com/Protected/RequestFeature.aspx

    In the interim, you would have to iterate the Fields in the FieldLayout and look at the (Cell|Label)WidthResolved values and use those to initialize the (Cell|Label)Width when you load them back in. Note, in the current builds available, the resolved properties will not return the resized value but this issue has been reported internally and will be addressed in the next hotfix. You may want to submit a report to the support group and reference issue BR25223 so you can be notified when the hotfix is available.

    • Post Points: 20
  • 01-23-2008 13:13 In reply to

    Re: What is the Best approach to getting and reapplying Column widths to a grid ?

     Hey Andrew,

    What you posted make sense, pretty simple for me to apply the widths back in during a FieldLayoutInit event.

     However, I would like to capture when the user changes the column widths, and update my local list of column widths.

    I tried to use the SizeChangedEvent on the LabelPresenter and HeaderPresenter and a few other classes.  But all these give me a SizeChanged event no matter how the column got resized.

    Is there an event tied specficly to when the user resizes a column?

    I want to capture it and go ahead and update my stored column widths.

    Any recommendation on how I could do this ?

    Thanks

    DK 

    • Post Points: 20
  • 01-24-2008 10:45 In reply to

    Re: What is the Best approach to getting and reapplying Column widths to a grid ?

    Unfortunately there isn't an event specific to resizing right now so I submitted a suggestion for it (as well as one for including save/load of user customizations). The SizeChanged event is defined on FrameworkElement and has to do with when the render size has changed so it would fire even when the element is just being positioned. I haven't tested this out but perhaps for now you could assume that a SizeChanged that occurs while the Mouse.LeftButton is Pressed means that a size change via a user interaction has changed (perhaps also limited to when the Mouse.Captured is non-null and is the DP or one of its descendants to ignore the case where a column is resized/positioned when the form, etc. is resized).

    • Post Points: 20
  • 01-24-2008 11:44 In reply to

    Re: What is the Best approach to getting and reapplying Column widths to a grid ?

    Hey Andrew,

     I will take a look at what you suggested with the mouse and go from there.

    Thanks For the quick response.

    If you get a chance to test out what your suggesting, could you post up some example code?

    Thanks

    DK

    • Post Points: 20
  • 05-13-2008 3:12 In reply to

    • meetnd
    • Top 150 Contributor
    • Joined on 05-09-2008
    • Points 362

    Re: What is the Best approach to getting and reapplying Column widths to a grid ?

    Hi,

    I also would like to save and re-apply column width when user changes it. Did any body found a proper solution to this? Any sample/suggestion would help.

    Thanks,

    ND

    • Post Points: 20
  • 07-25-2008 4:27 In reply to

    • dawidgd
    • Not Ranked
    • Joined on 07-25-2008
    • Points 5

    Re: What is the Best approach to getting and reapplying Column widths to a grid ?

     Hi,

    one of the soulution for catching user width change may be using SizeChange method and checking some of the fields from SizeChangedEventArgs:

      private void labelPresenter_SizeChanged(object sender, SizeChangedEventArgs e)
      {
           if (e.WidthChanged && e.PreviousSize.Width != 0)
           {               
                LabelPresenter lb = (e.OriginalSource as LabelPresenter);
                double colWidth = lb.Field.LabelWidthResolved;
           }
      }

     Thanks!

    • Post Points: 5
Page 1 of 1 (7 items)
Powered by Community Server (Commercial Edition), by Telligent Systems