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
205
Resize columns from header only
posted

How can I disallow column resizing within the grid and only allow it in the header? If that is not possible, the next best thing would be to prevent mouse cursor from changing to horizontal resizing cursor  within the grid and only allow it in the header. This is because when moving cursor in the grid, it constantly changes from arrow to horizontal resizing cursor and back, which is very distracting to the user as it makes UI feel unstable.

Parents
No Data
Reply
  • 69686
    posted

    Hello,

    One way to suppress resizing from the cells is to disable field resizing (AllowResize = false) when you are over a CellValuePresenter. For example :

    private void xdg_PreviewMouseMove(object sender, MouseEventArgs e)

            {

                LabelPresenter lp = Infragistics.Windows.Utilities.GetAncestorFromType(e.OriginalSource as DependencyObject, typeof(LabelPresenter), true) as LabelPresenter;

                if (lp == null)

                {

                    CellValuePresenter cvp = Infragistics.Windows.Utilities.GetAncestorFromType(e.OriginalSource as DependencyObject, typeof(CellValuePresenter), true) as CellValuePresenter;

                    if (cvp != null)

                        cvp.Field.Settings.AllowResize = false;

                }

                else

                {

                    lp.Field.Settings.AllowResize = true;

                }

            }

Children