Skip to main content

Microsoft Silverlight

Answered Question How to hide row header in DataGrid?RSS Feed

(0)

CodeLord
CodeLord

Member

Member

0 points

4 Posts

How to hide row header in DataGrid?

Dear colleagues, 

I need to have DataGrid without row headers at all. I tried attribute HeadersVisibility="Column", but a gap in front of first  column in grid header remains. How to kill this gap and completely hide row headers?

xusun
xusun

Participant

Participant

1015 points

167 Posts

Microsoft

Re: How to hide row header in DataGrid?

I didn't see the gap if I set HeadersVisibility="Column".  Did you do anything else on the style/template?  Could you post a picture if possible?

Thanks,

 

Thanks,
Xun Sun - MSFT

CodeLord
CodeLord

Member

Member

0 points

4 Posts

Re: How to hide row header in DataGrid?

Nothing special with styles, I create a new project, place grid on the page and set HeadersVisibility="Column". There is a small white empty space between border and grid header row (left side). Right side of the header is correct.

Here is an example, simple default project with default grid. Look at the left side of header row between grid left border and word "value":

http://silverlight.services.live.com/invoke/81060/GridTest/iframe.html

 

 

CodeLord
CodeLord

Member

Member

0 points

4 Posts

Answered Question

Re: How to hide row header in DataGrid?

Now I solved the problem by changing grid template in App.xaml.There is a child element TopLeftHeaderTemplate there. I set it's Visibility=Collapsed and the gap  disappeared.

Not very elegant, but it works. Maybe better solution exists?

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities