Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,
How to bind data to a datagrid for retrieving the output in a yearly leave calendar... and give sample projects

I have yearly leave calendar displaying months vertically and dates(1-31)horizontally. like i have a grid

MSIL
    <Grid x:Name="grdLeaveDetails"  
ShowGridLines="false"    Background="White" 
Height="274" Width="482" 
HorizontalAlignment="Center" 
VerticalAlignment="Center">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
            .............................................       
</Grid.ColumnDefinitions> .rows    <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>      
</Grid.RowDefinitions>.
 <Rectangle Grid.Row="1" Grid.ColumnSpan="32" 
Fill="SkyBlue" RadiusX="1" RadiusY="1" 
Height="0.5" 
Margin="0,21,0,0"/>...................
  <TextBlock Grid.Column="1" ><Run 
Text="01"/></TextBlock>.... <TextBlock Grid.Column="31" ><Run 
Text="31"/></TextBlock>  ...<TextBlock 
Grid.Column="0" Grid.Row="1" ><Run 
Text="Jan"/></TextBlock> ....      <TextBlock 
Grid.Column="0" Grid.Row="12" ><Run 
Text="Dec"/></TextBlock>
 <data:DataGrid x:Name="grdLeaveCalender" Margin="-
29,0,0,8" Grid.RowSpan="13" 
HorizontalAlignment="Left" Width="12" >
                <data:DataGrid.Columns>
                    <data:DataGridTemplateColumn>
                        <data:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Rectangle x:Name="rectrow"   
Grid.Column="{Binding ddHolidayDate}
" Grid.Row="{Binding mmHolidayDate}"  
Fill="Violet" ToolTipService.ToolTip="Holiday"/>
                            </DataTemplate>
                        </data:DataGridTemplateColumn.CellTemplate>
                    </data:DataGridTemplateColumn>
                </data:DataGrid.Columns>
            </data:DataGrid>
        </Grid>


am unable bind the data to the datagrid inside a gird... sorry for my Long code and explanation.
I get the leave dates from the database and need to bind the data and fill the rectangles formed accordingly


Thanks

[Removed the non-code text from the formatted block]
Posted
Updated 9-Mar-10 8:53am
v4

1 solution

 
Share this answer
 

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