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
0
Hello Paul,
Vlad
the Telerik team
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
Hi,
Vlad
the Telerik team
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
Hello,
Vlad
the Telerik team
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.
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}}}"