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
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>
Thx!
I just had to set the HorizontalAlignment="Stretch VerticalAlignment="Stretch" on my grid in the template. It doesn't fill the whole cell, but it is sufficient
<ig:TemplateColumn Key="R_Voor" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" > <ig:TemplateColumn.ItemTemplate> <DataTemplate> <Grid Background="{Binding R_ScoreColor}" HorizontalAlignment="Stretch VerticalAlignment="Stretch"> <TextBlock Text="{Binding R_Voor, StringFormat=' {0:0.##}'}"/> </Grid> </DataTemplate> </ig:TemplateColumn.ItemTemplate></ig:TemplateColumn>