This question is locked. New answers and comments are not allowed.
I have changed a single element in our styles: from Stretch to Top:
<Style TargetType="telerik:GridViewRow">
<Setter Property="VerticalContentAlignment" Value="Top"/>
</Style>
That does work.
But a bizarre side effect is that the row alternation gets broken. Nothing else is changed!
<Style TargetType="telerik:RadGridView">
<Setter Property="AlternateRowBackground" Value="{StaticResource Item_AlternateBackground}"/>
<Setter Property="AlternationCount" Value="2"/>
</Style>
Is this a bug? Or might there something else that causes this behaviour?
<Style TargetType="telerik:GridViewRow">
<Setter Property="VerticalContentAlignment" Value="Top"/>
</Style>
That does work.
But a bizarre side effect is that the row alternation gets broken. Nothing else is changed!
<Style TargetType="telerik:RadGridView">
<Setter Property="AlternateRowBackground" Value="{StaticResource Item_AlternateBackground}"/>
<Setter Property="AlternationCount" Value="2"/>
</Style>
Is this a bug? Or might there something else that causes this behaviour?
4 Answers, 1 is accepted
0
Robert
Top achievements
Rank 1
answered on 22 Jan 2014, 01:36 PM
Correction.
The intended behaviour was NOT achieved by my change.
What did work was the following.
<Style TargetType="telerik:GridViewCell">
<Setter Property="VerticalContentAlignment" Value="Top" /> <!-- This is particularly for TraceLogs. -->
<Setter Property="Padding" Value="5" />
</Style>
The observed problem remains, but is no longer relevant to me at this moment.
The intended behaviour was NOT achieved by my change.
What did work was the following.
<Style TargetType="telerik:GridViewCell">
<Setter Property="VerticalContentAlignment" Value="Top" /> <!-- This is particularly for TraceLogs. -->
<Setter Property="Padding" Value="5" />
</Style>
The observed problem remains, but is no longer relevant to me at this moment.
0
Hi,
You can fix this problem by setting the VerticalContentAlignment property of GridViewCell as you have already done. You can achieve the same result if you use VerticalAlignment instead of VerticalContentAlignment.
The main difference between VerticalAlignment and VerticalContentAlignment is that
VerticalAlignment determines the alignment of the control itself with respect to its parent control. However, the VerticalContentAlignment determines the controls content alignment with respect to the control.
When property's value is set to stretch, the element fills the entire layout slot of the parent element. You can find more details on how the different values of the property work here.
Regards,
Hristo
Telerik
You can fix this problem by setting the VerticalContentAlignment property of GridViewCell as you have already done. You can achieve the same result if you use VerticalAlignment instead of VerticalContentAlignment.
The main difference between VerticalAlignment and VerticalContentAlignment is that
VerticalAlignment determines the alignment of the control itself with respect to its parent control. However, the VerticalContentAlignment determines the controls content alignment with respect to the control.
When property's value is set to stretch, the element fills the entire layout slot of the parent element. You can find more details on how the different values of the property work here.
Regards,
Hristo
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Robert
Top achievements
Rank 1
answered on 27 Jan 2014, 10:02 AM
Well, yes, that is what I already found out myself. So, no answer to the problem.
What still remains is the matter of the no longer working alternation.
What still remains is the matter of the no longer working alternation.
0
Hello Robert,
By design the implicit style targeted at GridViewRow would not affect alternated rows. RadGridView exposes RowStyle and AlternateRowStyle properties. If you want to apply a style to normal and alternated rows, please use a style with x:Key and use the corresponding style properties, as shown below:
Regards,
Vanya Pavlova
Telerik
By design the implicit style targeted at GridViewRow would not affect alternated rows. RadGridView exposes RowStyle and AlternateRowStyle properties. If you want to apply a style to normal and alternated rows, please use a style with x:Key and use the corresponding style properties, as shown below:
<Style x:Key="style1" TargetType="telerik:GridViewRow"> ..... </Style><telerik:RadGridView RowStyle="{StaticResource style1}" AlternateRowStyle="{StaticResource style1}" ..... />Regards,
Vanya Pavlova
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>