This is a migrated thread and some comments may be shown as answers.

Cannot change column width

10 Answers 237 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jerry Kurata
Top achievements
Rank 1
Jerry Kurata asked on 31 Aug 2010, 05:17 PM
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".

10 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 01 Sep 2010, 06:53 AM
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
0
Jerry Kurata
Top achievements
Rank 1
answered on 01 Sep 2010, 04:55 PM
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.

0
Vlad
Telerik team
answered on 02 Sep 2010, 08:46 AM
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
0
Jerry Kurata
Top achievements
Rank 1
answered on 02 Sep 2010, 05:32 PM
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.
0
Milan
Telerik team
answered on 06 Sep 2010, 03:54 PM
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
0
Jerry Kurata
Top achievements
Rank 1
answered on 07 Sep 2010, 09:25 PM
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
0
Vlad
Telerik team
answered on 08 Sep 2010, 06:33 AM
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
0
Jerry Kurata
Top achievements
Rank 1
answered on 08 Sep 2010, 07:56 PM
Ok.  I submitted ticket 346428.

0
Ars
Top achievements
Rank 1
answered on 27 May 2014, 12:31 PM
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?
0
Boris
Telerik team
answered on 30 May 2014, 11:37 AM
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.
 
Tags
GridView
Asked by
Jerry Kurata
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Jerry Kurata
Top achievements
Rank 1
Milan
Telerik team
Ars
Top achievements
Rank 1
Boris
Telerik team
Share this question
or