CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Dec 2005
    Posts
    180

    How do you dynamically assign a datagrid's headers in c#?

    How do you dynamically assign a datagrid's headers in c#?

    Consider the following XAML:
    Code:
                    <data:DataGrid  x:Name="dataGrid" AutoGenerateColumns="False"  Margin="1,1,1,1" >
                        <data:DataGrid.Columns>
                            <data:DataGridTextColumn
                                Header="Substantive"
                                Binding="{Binding Path=Substantive}"
                                IsReadOnly="True"
                                />
    
                            <data:DataGridTextColumn
                                Header=""
                                Binding="{Binding Path=Month[0]}"
                                IsReadOnly="True"
                                />
    
                            <data:DataGridTextColumn
                                Header=""
                                Binding="{Binding Path=Month[1]}"
                                IsReadOnly="True"
                                />
    
                        </data:DataGrid.Columns>
    
                    </data:DataGrid>
    In the C# code, how would I define the headers that are blank?
    Last edited by Complete; August 1st, 2011 at 09:23 PM. Reason: code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured