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

Column Padding

4 Answers 184 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Voss Grose
Top achievements
Rank 1
Voss Grose asked on 19 Oct 2009, 06:54 PM
How do I remove all padding from columns/cells?

There seems to always be a little left and right padding.

4 Answers, 1 is accepted

Sort by
0
Kalin Milanov
Telerik team
answered on 22 Oct 2009, 10:48 AM
Hello Voss Grose,

You can use the CellStyle property of the column and set the padding to 0.
Attached I am sending you are sample which does just that.

Sincerely yours,
Kalin Milanov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Aaron
Top achievements
Rank 1
answered on 08 Feb 2011, 06:17 PM
I can't get the cellpadding style to take affect. Is it because I have a button in that column?

<UserControl x:Class="TestGrid.MainPage"
    xmlns:TelerikGridView="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView"  
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
    mc:Ignorable="d"
    Height="Auto" Width="360">
    <UserControl.Resources>
        <Style x:Key="NoPaddingCell" TargetType="TelerikGridView:GridViewCell">
            <Setter Property="Padding" Value="0"/>
        </Style>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White">
        <telerik:RadGridView Name="FileList" CanUserReorderColumns="False" IsFilteringAllowed="False" IsReadOnly="True" CanUserFreezeColumns="False" CanUserResizeColumns="False" RowIndicatorVisibility="Collapsed" ShowGroupPanel="False" CanUserInsertRows="False" CanUserDeleteRows="False" BorderThickness="0" AutoGenerateColumns="False" RowHeight="20" ScrollViewer.VerticalScrollBarVisibility="Auto" AlternateRowBackground="#FFF0F0F0" AlternationCount="2" >
            <telerik:RadGridView.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="White" Offset="0"/>
                    <GradientStop Color="#FFCFD3D8" Offset="1"/>
                    <GradientStop Color="#FFE9E9EA" Offset="0.659"/>
                    <GradientStop Color="#FFF4F4F5" Offset="0.375"/>
                </LinearGradientBrush>
            </telerik:RadGridView.Background>
            <telerik:RadGridView.Columns>
                <telerik:GridViewImageColumn UniqueName="ThumbnailColumn" DataMemberBinding="{Binding ThumbnailURL}" Header="" Width="40" Background="Transparent"/>
                <telerik:GridViewDataColumn UniqueName="FileDescriptionColumn" DataMemberBinding="{Binding Description}" Header="File" Width="*" IsVisible="True"/>
                <telerik:GridViewDataColumn UniqueName="FolderDescriptionColumn" DataMemberBinding="{Binding FolderDisplay}" Header="Folder" Width="80" IsVisible="True"/>
                <telerik:GridViewDataColumn UniqueName="CabinetColumn" DataMemberBinding="{Binding CabinetName}" Header="Cabinet" Width="80" IsVisible="True" />
                <telerik:GridViewColumn UniqueName="PropertiesColumn" IsVisible="True" CellStyle="{StaticResource NoPaddingCell}" Width="Auto">                    
                    <telerik:GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <telerik:RadButton Padding="0,0,0,0" Width="10" Height="Auto" Background="Black" >
                                <StackPanel Orientation="Vertical">
                                    <TextBlock Text="." Foreground="White" Margin="0,-6,0,-2" Padding="0"/>
                                    <TextBlock Text="." Foreground="White" Margin="0,-6,0,-2" Padding="0"/>
                                    <TextBlock Text="." Foreground="White" Margin="0,-6,0,0" Padding="0"/>
                                </StackPanel>
                            </telerik:RadButton>
                        </DataTemplate>
                    </telerik:GridViewColumn.CellTemplate>
                </telerik:GridViewColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </Grid>
</UserControl>
0
Vlad
Telerik team
answered on 14 Feb 2011, 10:44 AM
Hello,

 You should remove Width setting of the button if you want the button to occupy the entire cell.  

All the best,
Vlad
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Voss Grose
Top achievements
Rank 1
answered on 15 Apr 2011, 06:32 PM
Is this still the preferred method of setting the padding?
CellStyle property of the column and set the padding to 0

It seems to degrade the vertical scrolling performance is I add it to all 8 of my cells.

* And why is left padding applied by default to all cells? Seems like 0 padding should be the default.
Tags
GridView
Asked by
Voss Grose
Top achievements
Rank 1
Answers by
Kalin Milanov
Telerik team
Aaron
Top achievements
Rank 1
Vlad
Telerik team
Voss Grose
Top achievements
Rank 1
Share this question
or