While upgrading our Silverlight application to use the latest Telerik controls (from Q2 2009 to Q1 2010) I noticed a change in the way a grid is displayed. In our application, users can customize which columns they display and previously, an empty gray space appeared when the columns were done rendering.
However now, there's this... 'empty column' is the best way I can describe it, that spans across that empty space. Is this an option to turn off somewhere?
(see attached images - old versus new)
However now, there's this... 'empty column' is the best way I can describe it, that spans across that empty space. Is this an option to turn off somewhere?
(see attached images - old versus new)
9 Answers, 1 is accepted
0
Hello Rick,
You can avoid this space if you set Width="*" for the last grid column.
Greetings,
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.
You can avoid this space if you set Width="*" for the last grid column.
Don't hesitate to contact us if you have other questions.
Greetings,
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
Rick Glos
Top achievements
Rank 1
answered on 25 Mar 2010, 01:58 PM
I do I set this value in code? I create the columns in code because the columns vary.
viewColumn.Measure.Width above being a value stored in the database.
It appears that the width is set using a GridViewLength type. The constructor looks like it has an overload for passing in a GridLengthUnitType. Is this what I'm supposed to be passing in?
If I set that to star - that is certainly NOT what I want... A column spanning across the entire width of the application.
GridViewDataColumn column = new GridViewDataColumn(); |
column.Width = new GridViewLength(viewColumn.Measure.Width); |
viewColumn.Measure.Width above being a value stored in the database.
It appears that the width is set using a GridViewLength type. The constructor looks like it has an overload for passing in a GridLengthUnitType. Is this what I'm supposed to be passing in?
If I set that to star - that is certainly NOT what I want... A column spanning across the entire width of the application.
GridViewDataColumn column = new GridViewDataColumn(); |
//column.Width = new GridViewLength(viewColumn.Measure.Width); |
column.Width = new GridViewLength(viewColumn.Measure.Width, GridViewLengthUnitType.Star); |
0
Hello,
You can set this to one star:
new GridViewLength(1, GridViewLengthUnitType.Star);
Greetings,
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.
You can set this to one star:
new GridViewLength(1, GridViewLengthUnitType.Star);
Greetings,
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
Rick Glos
Top achievements
Rank 1
answered on 25 Mar 2010, 03:08 PM
That doesn't change anything. The column stretches across the entire width of the application, which looks very silly when you're just display a single column with a number like Quantity Sold. What happened to the dark gray area like I showed in my first post - the area where there aren't any columns to display?
0
Hi,
I've attached an example application to illustrate you how the grid will look if you have last column width set to star.
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.
I've attached an example application to illustrate you how the grid will look if you have last column width set to star.
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
Accepted
Hi,
Just a quick update. In case you want the old behavior I've attached modified version of my application to illustrate you how to achieve this easily. Here is the grid XAML:
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.
Just a quick update. In case you want the old behavior I've attached modified version of my application to illustrate you how to achieve this easily. Here is the grid XAML:
<
telerikGrid:RadGridView
ItemsSource
=
"{Binding}"
Background
=
"Silver"
>
<
telerikGrid:RadGridView.RowStyle
>
<
Style
TargetType
=
"telerikGridView:GridViewRow"
>
<
Setter
Property
=
"HorizontalAlignment"
Value
=
"Left"
/>
</
Style
>
</
telerikGrid:RadGridView.RowStyle
>
</
telerikGrid:RadGridView
>
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
Rick Glos
Top achievements
Rank 1
answered on 25 Mar 2010, 05:17 PM
Apparently what I am asking can no longer be done or the grid has lost this functionality.
In your sample, you get the last column as one very very wide column.
Adding the HorizontalAlignment setter changed nothing.
If I swap out the binaries with the ones from 2009.2.812.1030 I get the exact thing I'm looking for. Gray space were there isn't any columns. We can even comment out your code that sets the last column to star because we don't need it. And if there are only 5 rows, as shown in my image, there's gray space underneath the grid as well until you get to the bottom of the browser window.
Go ahead, switch to the old binaries and see for yourself.
In your sample, you get the last column as one very very wide column.
Adding the HorizontalAlignment setter changed nothing.
If I swap out the binaries with the ones from 2009.2.812.1030 I get the exact thing I'm looking for. Gray space were there isn't any columns. We can even comment out your code that sets the last column to star because we don't need it. And if there are only 5 rows, as shown in my image, there's gray space underneath the grid as well until you get to the bottom of the browser window.
Go ahead, switch to the old binaries and see for yourself.
0
Hello,
I've attached screenshot from my application with HorizontalAlignment.
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.
I've attached screenshot from my application with HorizontalAlignment.
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
Rick Glos
Top achievements
Rank 1
answered on 25 Mar 2010, 05:45 PM
Excellent. I was able to figure out the problem.
In your sample app, the xml namespace was this: xmlns:Telerik_Windows_Controls_GridView
And when I copy pasted your code snippet it was looking for this:
And to compound the problem, when hitting F5, it was not giving me any errors and was using the old code in the bin\Debug folder to run the app. I had to manually delete that folder, plus clean the solution to blow away the obj folder for the error to appear.
Anyway - for anyone following this - you don't need the star column, just that HorizontalAlignment setter does the trick along with setting the background color to something other than white.
Thanks Vlad.
In your sample app, the xml namespace was this: xmlns:Telerik_Windows_Controls_GridView
And when I copy pasted your code snippet it was looking for this:
telerikGridView:GridViewRow
And to compound the problem, when hitting F5, it was not giving me any errors and was using the old code in the bin\Debug folder to run the app. I had to manually delete that folder, plus clean the solution to blow away the obj folder for the error to appear.
Anyway - for anyone following this - you don't need the star column, just that HorizontalAlignment setter does the trick along with setting the background color to something other than white.
Thanks Vlad.