Cannot change column width

11 posts, 1 answers
  1. Jerry Kurata
    Jerry Kurata avatar
    92 posts
    Member since:
    Feb 2010

    Posted 31 Aug 2010 Link to this post

    For some reason I cannot change the width of my columns.  The two-way arrow appears, but left mouse and drag does nothing.  Is this because I am setting column width and minwidth? The columns are added dynamically and IsResizable = "true".
  2. Answer
    Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 01 Sep 2010 Link to this post

    Hello,

     If the MinWidth is equal to Width you will unable to resize the columns. 

    Best wishes,
    Vlad
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Jerry Kurata
    Jerry Kurata avatar
    92 posts
    Member since:
    Feb 2010

    Posted 01 Sep 2010 Link to this post

    Do you know why that restriction exists?

    My assumptions were that the MinWidth was the minimum width the user could set for the column.  MaxWidth was the maximum width the user could set for the column. Width was the current width of the column.  Mathematically, MinWidth <= Width <= MaxWidth.

  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 02 Sep 2010 Link to this post

    Hi,

     Yes, but since other columns MinWidth is set as well you will unable to resize the column.

    Sincerely yours,
    Vlad
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Jerry Kurata
    Jerry Kurata avatar
    92 posts
    Member since:
    Feb 2010

    Posted 02 Sep 2010 Link to this post

    So what is the proper way to accomplish the following:
    1. Columns generated dynamically
    2. The grid is a fixed width with horizontal scrolling as required to see all columns.
    3. If the columns do not fill the grid the last column, rightmost, should fill the remaining space (we set width of last column to new gridLength(1, GridViewLengthUnitType.Star) to accomplish this.
    4. One column must change  width since it contain an image and the user can set the image size to small, medium, or large.
    5. It would be nice for the user user to be able to resize the other columns.
    6. It would be nice to be able to limit the width of columns.

    What we see is that if we set the min width of columns the user can scroll to see the off screen columns.  But when the columns are wide enough to need scrolling the columns resizing is disabled.  And if we do not set the min width the columns shrink a bit, horizontal scrolling does not enable, and there are columns the user cannot see.

    Any assistance in making the RadGridView work in the manner described in the list would be appreciated.
  7. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 06 Sep 2010 Link to this post

    Hello Jerry Kurata,

    I have created a sample project that demonstrates such approach. In the attached sample the first column has no restrictions, the second and the third can have minimal width of 50 and maximum width of 150, while the last column occupies the remaining space. All but last column can be resized. 


    Sincerely yours,
    Milan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Jerry Kurata
    Jerry Kurata avatar
    92 posts
    Member since:
    Feb 2010

    Posted 07 Sep 2010 Link to this post

    Milan,

    Thank you very much for the sample. With a few tweaks I was able to make it perform with the issues we see.  I would like to send you the project showing the errors.  Is there an email address where I can send the zipped up project?

    In the meantime, what I did was add a few more columns, set the horizontal scroll bar to "auto", and increase the MinWidth from 50 to 80.  When you do this the horizontal scrollbar appears, but you can no longer resize any of the columns even though the MinWidth is 30 or more units smaller than MaxWidth.  Below is the code I used.

    .XAML
    telerik:RadGridView HorizontalAlignment="Left" Margin="12,12,0,0" Name="gridViewTest"
                            AutoGenerateColumns="False" VerticalAlignment="Top" Height="262" Width="499"
                            ScrollViewer.HorizontalScrollBarVisibility="Auto" />

    .XAML.CS
    var firstColumn = new GridViewDataColumn() {UniqueName="PersonID", DataMemberBinding = new Binding("PersonID"), Header = "Person ID", MinWidth = 80, MaxWidth = 100 };
    var secondColumn = new GridViewDataColumn() { UniqueName = "LastName", DataMemberBinding = new Binding("LastName"), Header = "Last Name", MinWidth = 80, MaxWidth = 150 };
    var thirdColumn = new GridViewDataColumn() { UniqueName = "FirstName", DataMemberBinding = new Binding("FirstName"), Header = "First Name", MinWidth = 80, MaxWidth = 150 };
    var fourthColumn = new GridViewDataColumn() { UniqueName = "Address", DataMemberBinding = new Binding("Address"), Header = "Address (Street)", MinWidth = 80, MaxWidth = 150 };
    var fifthColumn = new GridViewDataColumn() { UniqueName = "City", DataMemberBinding = new Binding("City"), Header = "City", MinWidth = 80, MaxWidth = 120 };
    var sixthColumn = new GridViewDataColumn() { UniqueName = "State", DataMemberBinding = new Binding("State"), Header = "State", MinWidth = 80, MaxWidth = 120 };
    var seventhColumn = new GridViewDataColumn() { UniqueName = "Zip", DataMemberBinding = new Binding("Zip"), Header = "Zip", Width = new GridViewLength(1, GridViewLengthUnitType.Star) };

                this.gridViewTest.Columns.Add(firstColumn);
                this.gridViewTest.Columns.Add(secondColumn);
                this.gridViewTest.Columns.Add(thirdColumn);
                this.gridViewTest.Columns.Add(fourthColumn);
                this.gridViewTest.Columns.Add(fifthColumn);
                this.gridViewTest.Columns.Add(sixthColumn);
                this.gridViewTest.Columns.Add(seventhColumn);

    Thanks,

    jerry
  9. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 08 Sep 2010 Link to this post

    Hi,

     You can open support ticket and send us the project. 

    Best wishes,
    Vlad
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  10. Jerry Kurata
    Jerry Kurata avatar
    92 posts
    Member since:
    Feb 2010

    Posted 08 Sep 2010 Link to this post

    Ok.  I submitted ticket 346428.

  11. Ars
    Ars avatar
    7 posts
    Member since:
    Aug 2011

    Posted 27 May 2014 Link to this post

    Hi, Vlad and Jerry Kurata

    I`ve faced with the same issue

    1. I`ve several Columns with setted MinWidth=50 and MaxWidth=150.
    2. RadGridView property "ScrollViewer.HorizontalScrollBarVisibility = auto".
    3. The width of RadGridView is bigger then screen size, for example RadGridView size = 1280px and browser size = 1024px.

    The problem is that user cannot resize columns width. What the appropriate way to solve it?
  12. Boris
    Admin
    Boris avatar
    276 posts

    Posted 30 May 2014 Link to this post

    Hello Ars,

    I'm not entirely sure what you mean by: user cannot resize columns width.
    I attached a sample project in which I tired the mentioned steps. However, I was able to resize the columns to the set MinWidth and MaxWidth.

    However, if you are still able to reproduce the issue in the sample project, could you please write to us a step by step guide how to reproduce it on our end ?

    Thank you for your cooperation in advance.

    Regards,
    Boris Penev
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top
DevCraft banner