Click here to Skip to main content
15,913,854 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
-----------------------------------------------------------------
This is my .xaml code fore display grid
-----------------------------------------------------------------
XML
<Grid Grid.Row="5" Name="gridHistoricPerformance" Height="Auto" Width="Auto" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="5,25,5,10">
                      <Grid.RowDefinitions>
                          <RowDefinition Height="Auto"/>
                          <RowDefinition Height="Auto"/>
                      </Grid.RowDefinitions>
                      <my:DataGrid Grid.Row="5" Height="Auto" Width="Auto" HorizontalAlignment="Left" VerticalAlignment="Top" Name="dgHistoricPerformance" Margin="0,1,0,5"  Background="{x:Null}" BorderBrush="Black" BorderThickness="0,2,0,0" IsReadOnly="True" FontSize="20" GridLinesVisibility="All" HeadersVisibility="Column" ColumnHeaderHeight="50" >
                          <my:DataGrid.ColumnHeaderStyle>
                              <Style TargetType="my1:DataGridColumnHeader">
                                  <Setter Property="Background" Value="Transparent"/>
                                  <Setter Property="Height" Value="0"/>
                                  <Setter Property="BorderThickness" Value="0,0,0,2"/>
                                  <Setter Property="BorderBrush" Value="Black"/>
                              </Style>
                          </my:DataGrid.ColumnHeaderStyle>
                      </my:DataGrid>
                  </Grid>

--------------------------------------------------------------------------------
backend code for display colume in grid
-----------------------------------------------------------------
ds = new DataSet();
DataTable dt = new DataTable();
ds.Tables.Add(dt);

DataColumn cl = new DataColumn("Col1", typeof(string));
cl.MaxLength = 100;
dt.Columns.Add(cl);

cl = new DataColumn("Col2", typeof(string));
cl.MaxLength = 100;
dt.Columns.Add(cl);

DataRow rw = dt.NewRow();
dt.Rows.Add(rw);
rw["Col1"] = "Value1";
rw["Col2"] = "Value2";


dgHistoricPerformance.ItemsSource = ds.Tables[0].DefaultView;

-------------------------------------------------------------------------------------
when i run this code this is display row but note display column header and property which is i am missing if any idea about this please tell me

-its nit display column header....
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900