Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2320
TemplateColumn with Button padding problem
posted

I have a column in my grid which displays a button.  For some reason the button displays in the column but with additional padding that I can't figure out how to remove.  I also use DataGrid in other forms and I don't get this spacing problem.  Here is the xaml for the column

<igGrid:TemplateColumn Key="*"  Width="32">
                                <igGrid:TemplateColumn.ItemTemplate>                                   
                                    <DataTemplate>
                                        <Grid Width="32">
                                        <Button Click="Button_Click" Width="32" ToolTipService.ToolTip="Click to rollback" Padding="0"
                                                Visibility="{Binding  Path=Customized, Converter={StaticResource rollbackVisibilityValueConverter}}"
                                                Style="{StaticResource rollbackImageContent}">
                                        </Button>
                                            </Grid>
                                    </DataTemplate>
                                </igGrid:TemplateColumn.ItemTemplate>
                            </igGrid:TemplateColumn>

 

The button displays an image, and its width is 32.  In a regular datagird, the button fills the entire column perfectly when I set its width to 32.  In the XamWebGrid I have to make the width 42 because there appears to be a bunch of spacing/padding around the button.

Any help would be greatly appreciated.

Parents
  • 40030
    Verified Answer
    Offline posted

    Hi, 

    So, all you need to do is remove the padding from the CellControl, which you can do via a style:

     <ig:TemplateColumn.CellStyle>

                            <Style TargetType="igGrid:CellControl">

                                <Setter Property="Padding" Value="0"/>

                            </Style>

                        </ig:TemplateColumn.CellStyle>

    Hope this helps, 

    -SteveZ

Reply Children
No Data