Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
250
TemplateColumn.ItemTemplate > Fill cell
posted

Hi,

I have a Template columns wich represents a score. 
The background in bound to R_ScoreColor.

<ig:TemplateColumn Key="R_Voor" >
  <ig:TemplateColumn.ItemTemplate>                                        
    <DataTemplate>                                            
      <Grid Background="{Binding R_ScoreColor}" HorizontalAlignment="Center">
        <TextBlock Text="{Binding R_Voor, StringFormat=' {0:0.##}'}"/>
      </Grid>                                            
    </DataTemplate>
  </ig:TemplateColumn.ItemTemplate>
</ig:TemplateColumn>  

This works fine, but not the whole cell is filled:

How can I make sure the cell is filled, so the whole background is colored?

I have already looked at the Conditional formating using CellControlAttached event, but I would like to use my approach because it its cleaner as the binding for R_ScoreColor is used in other places on the page.

 

Thx,

Bart

Parents
  • 20
    posted

    hi

    add  HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"  will do that.

    like this:

    <ig:TemplateColumn Key="R_Voor" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" >
      <ig:TemplateColumn.ItemTemplate>                                        
        <DataTemplate>                                            
          <Grid Background="{Binding R_ScoreColor}" HorizontalAlignment="Center">
            <TextBlock Text="{Binding R_Voor, StringFormat=' {0:0.##}'}"/>
          </Grid>                                            
        </DataTemplate>
      </ig:TemplateColumn.ItemTemplate>
    </ig:TemplateColumn> 

Reply Children
No Data