Friday, October 21, 2011

WPF DataGrid Cell Color Change

DataGrid's ROW & CELL color Changing is one of most important part in our development. if you want to change Data grid specific cell Background just like:


use the xaml code for "Remaining Day" column in your Datagrid.

 <DataGridTemplateColumn Header="Remaining Day" Width="150">  
           <DataGridTemplateColumn.CellTemplate>  
                <DataTemplate>  
                     <Border x:Name="brdBroder" VerticalAlignment="Stretch" Margin="1">  
                          <TextBlock Text="{Binding RemainLeave}" Margin="3,1" x:Name="txtTextBlock"/>  
                     </Border>  
                     <DataTemplate.Triggers>  
                          <DataTrigger Binding="{Binding RemainLeave}" Value="0">  
                               <Setter TargetName="brdBroder" Property="Background" Value="Green"/>  
                               <Setter TargetName="txtTextBlock" Property="Foreground" Value="White"/>  
                          </DataTrigger>  
                     </DataTemplate.Triggers>  
                </DataTemplate>  
           </DataGridTemplateColumn.CellTemplate>  
      </DataGridTemplateColumn>  

Enjoy...

SQL Get all Index create script from Database

To get all script from database as a create new index into another database you can use the following --Get all Index Script SELECT...