Silverlight: Grid Control – Hide Row or Column

It seems like there is quite a bit of confusion about how to go about hiding a row or a column in the Grid control. Take the Grid control as defined below with two rows:

<Grid Name="grid" Height="100" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Width="200">

If you want to hide the first row, simply do the following:

// Hide the first row
this.grid.RowDefinitions[0].Height = new GridLength(0);

The same thing can be done to hide columns except instead of accessing the RowDefinitions collection, access the ColumnDefinitions collection.

4 Responses to “Silverlight: Grid Control – Hide Row or Column”

  1. negm phlestin Says:

    Thank you , you saved my day

  2. Pol Says:

    Thanks. It was helpful.

  3. vijay Says:

    great man!

  4. hamad2 Says:

    I know its old post, but its really Helpful thanks

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: