locked
Margin & Padding in Individual Grid Cells RRS feed

  • Question

  • I am relatively new to Silverlight & XAML, and would like to know if there is a way to set the padding for individual cells in a Grid control. I currently have a Grid control and the following TextBox:

    <TextBox Name="TextBox1" Grid.Row="1" Grid.Column="1"
                        Margin="0" Padding="0" Width="50" Height="50"
                        FontSize="26" FontFamily="Arial"
                        BorderThickness="0"
                        TextAlignment="Center"
                        HorizontalAlignment="Left"
                        HorizontalContentAlignment="Left"
                        VerticalAlignment="Top"
                        VerticalContentAlignment="Top"
                        Text="X"/>

    My goal is to have the TextBox take up the entire cell. The Margin & Padding are already 0, and no matter what I change the Width & Height to there are always a few extra pixels on the left & top in the cell. How do I get rid of this extra undesired space? Thanks.


    Nathan Sokalski
    njsokalski@hotmail.com
    http://www.nathansokalski.com/


    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/
    Friday, February 18, 2011 6:30 AM