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

MaxColumnWidth - apply to all columns?

6 Answers 81 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 15 Oct 2010, 10:31 PM
I'd like to set my columns to Auto for size, however I do not want to allow scrolling of any kind, nor should the column on the right dissapear off the right hand side.  I was hoping this property was a cumulative for all columns but it appears it's for each column.  Is there any way to make the columns size automatically but truncate data to fit in the screen they are given?

6 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 18 Oct 2010, 07:38 AM
Hello Paul,

 You can set ColumnWidth="*" for the grid if you do not want horizontal scrolling. 

Kind regards,
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
Paul
Top achievements
Rank 1
answered on 18 Oct 2010, 03:10 PM
I have tried that.  Setting ColumnWidth="*" on the grid makes each column wider than the screen it's on.  Screenshots attached.
0
Vlad
Telerik team
answered on 18 Oct 2010, 03:16 PM
Hi,

 This may happen if the grid is measured with infinity Width. How the grid is declared in your case? Can you check if RadGriView is not inside of StackPanel?

Regards,
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
Paul
Top achievements
Rank 1
answered on 18 Oct 2010, 03:18 PM
It is inside a scrollviewer.  I couldn't seem to get a vertical scrollbar without using this.
0
Vlad
Telerik team
answered on 18 Oct 2010, 03:20 PM
Hello,

 ScrollViewer will measure with infinity height/width as well. It will be better if you use standard Grid instead. 

All the best,
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
Paul
Top achievements
Rank 1
answered on 18 Oct 2010, 04:27 PM
The problem looks to be partially solved.  For anyone else who runs into this, here's a solution.

The ultimate goal was to have the column size behave as follows (For N columns) :
  - IF there was room for all data, then Columns 1 to (N-1) would be sized as Auto. No extra space would be given to them. Column N would be star sized and take up any remaining room on the screen.
 - IF there was NOT room for all data, then some columns would still Auto size to always show data, and some columns would Star size.  These Star sized columns would each truncate data to fit the full grid on the screen and the amount truncated would be proportional to their size.

I never did find a way to do this, and eventually gave up.  My second goal was to simply stop the gridview from getting wider than the available space.  Placing the GridView into a grid did not help.  In the end I set Columns 1 to (N-1) to be Auto sized and Column N to be Star sized.  Then I added the following inefficient but working line to the grid that the GridView was in.

Width="{Binding ActualWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ScrollContentPresenter}}}"
Tags
GridView
Asked by
Paul
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Paul
Top achievements
Rank 1
Share this question
or