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

Weird cell vertical alignment

1 Answer 28 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Edward
Top achievements
Rank 1
Edward asked on 10 May 2011, 08:24 PM
Please see the attached screenshot.  Essentially some cell is aligned at the top, while some cell is aligned in the middle.

<Style TargetType="telerik:GridViewCell" x:Key="CustomCellStyle">
    <Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>

Code in question:

<telerik:GridViewDataColumn Header="Name" DataMemberBinding="{Binding pplName, Converter={StaticResource NameConverter}}" CellStyle="{StaticResource CustomCellStyle}"/>
<telerik:GridViewDataColumn Header="Relationship" DataMemberBinding="{Binding defRelationship.desc1}" CellStyle="{StaticResource CustomCellStyle}"/>
<telerik:GridViewDataColumn Header="Gender" DataMemberBinding="{Binding pplName.defGender.desc1}" CellStyle="{StaticResource CustomCellStyle}"/>
<telerik:GridViewDataColumn Header="Age" DataMemberBinding="{Binding pplName.birthDate, Converter={StaticResource BirthdateAgeConverter}}" CellStyle="{StaticResource CustomCellStyle}"/>
<telerik:GridViewDataColumn Header="Lives With Client"  DataMemberBinding="{Binding livesWithClient, Converter={StaticResource TriStateConverter}, ConverterParameter=Text}" CellStyle="{StaticResource CustomCellStyle}"  />

NameConverter just convert the entity into a display name (return as string)
BirthdateAgeConverter calcualtes age from birthdate (return as string)
TriStateConverter convert a bool? value into string

1 Answer, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 11 May 2011, 08:23 AM
Hello Edward,

 

As I can see from the attached picture you have applied our Windows7 theme to RadGridView.
Indeed the styles we are using are theme specific.
If you want to apply a simple style in Silverlight based on some theme you should follow this pattern:


<Style x:Key="style1" TargetType="telerik:GridViewCell" telerik:StyleManager.BasedOn="Windows7">
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>


I have just test this behavior and everything works fine by my side.
May you please check the attached project and let me know how it differs from yours?



All the best,
Vanya Pavlova
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
Tags
GridView
Asked by
Edward
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Share this question
or