• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 363
  • Last Modified:

datagrid fixed column

hi,

how can i resize and hide (or remove) fixed column of a datagrid in my c# ppc application.

thanks.
0
janavar
Asked:
janavar
  • 6
  • 5
1 Solution
 
bungHocCommented:
Don't have a running C# here so can't give you tested code. But you can hide column by simple set colum's width to 0:

private DataGridColumnStyle dgcStyle;
dgcStyle.Width = 0;

OR use methods DataGridColumnCollection.Remove and DataGridColumnCollection.RemoveAt

Hope this helps.
0
 
janavarAuthor Commented:
i do not mean user defined columns i mean default datagrid first column.
0
 
janavarAuthor Commented:
i mean rowheader
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
bungHocCommented:
As far as I know, row header doesn't display anything, it just gives some space to the left of the row to show the selected row or if a row is being edited. Is that what you want to remove/hide?

If so try this: this.somethingDataGrid.RowHeadersVisible = false;

or even more funny approach:

Subclass DataGrid, override OnPaint method
0
 
janavarAuthor Commented:
>>If so try this: this.somethingDataGrid.RowHeadersVisible = false;
yes, that works tohide but how can i resize it?

thanks...
0
 
bungHocCommented:
Try this: SomethingDataGrid.RowHeaderWidth = 0
0
 
janavarAuthor Commented:
i am developing at compact frame work for pocket pc and datagrid object does not have "RowHeaderWidth" property.
0
 
bungHocCommented:
Don't get it, why do you need to resize it if you already hid it?
0
 
janavarAuthor Commented:
sometimes it is needed ;)
0
 
bungHocCommented:
     // Create DataGridTableStyle used for table
      DataGridTableStyle tabStyle = new DataGridTableStyle();
     
      tabStyle.RowHeaderWidth = 30;
0
 
janavarAuthor Commented:
thank.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now