Hi,
I've to set the background of a cell to a special color. I used the GridViewColumn.CellTemplate.
My color works, but it doesn't use the whole size of the column. It's because the Grid doesn't take the full size of the column. I found that this is even present with ListView. A workaround is to set the to set HorizontalContentAlignment to stretch through the ItemContainerStyle.
I found example of that for ListView:
My only problem is to find the "TargetType" I should put for the RadGridView:
Could you tell me what I need to put here?
Thank you
I've to set the background of a cell to a special color. I used the GridViewColumn.CellTemplate.
<
telerik:GridViewColumn.CellTemplate
>
<
DataTemplate
>
<
Grid
Margin
=
"0"
Background
=
"{Binding Converter={StaticResource MyFirstConverter}, UpdateSourceTrigger=PropertyChanged}"
>
<
CheckBox
IsChecked
=
"{Binding ShouldDisplayCalendar, UpdateSourceTrigger=PropertyChanged}"
HorizontalAlignment
=
"Center"
IsEnabled
=
"False"
/>
</
Grid
>
</
DataTemplate
>
</
telerik:GridViewColumn.CellTemplate
>
My color works, but it doesn't use the whole size of the column. It's because the Grid doesn't take the full size of the column. I found that this is even present with ListView. A workaround is to set the to set HorizontalContentAlignment to stretch through the ItemContainerStyle.
I found example of that for ListView:
<
ListView.ItemContainerStyle
>
<
Style
TargetType
=
"ListViewItem"
>
<
Setter
Property
=
"HorizontalContentAlignment"
Value
=
"Stretch"
/>
</
Style
>
</
ListView.ItemContainerStyle
>
My only problem is to find the "TargetType" I should put for the RadGridView:
<
telerik:RadGridView.ItemContainerStyle
>
<
Style
TargetType
=
"??????"
>
<
Setter
Property
=
"HorizontalContentAlignment"
Value
=
"Stretch"
/>
</
Style
>
</
telerik:RadGridView.ItemContainerStyle
>
Could you tell me what I need to put here?
Thank you