Hello team,
I want to set the background color of a single cell in my gridview.
The bound object contains a string with the hex value of the color. The property is BackcolorHex.
This is my converter function:
The string is shown in the cell right. But the backcolor does not change. It's always white. Could you please tell me what i'm doing wrong?
Thank you very much.
Best regards from Germany!
I want to set the background color of a single cell in my gridview.
The bound object contains a string with the hex value of the color. The property is BackcolorHex.
<telerik:RadGridView Grid.Row="11" Grid.Column="1" Grid.ColumnSpan="4" AutoGenerateColumns="False" ItemsSource="{Binding WorkflowView}" RowHeight="25" CanUserFreezeColumns="False" telerikQuickStart:ThemeAwareBackgroundBehavior.IsEnabled="True" IsSynchronizedWithCurrentItem="True" IsEnabled="{Binding ModelController.WorkflowHelper.IsWorkflowEditing, Converter={StaticResource InvertBoolConv}}"> <telerik:RadGridView.Resources> <Style x:Key="CellBGStyle" TargetType="telerik:GridViewCell"> <Setter Property="Background" Value="{Binding Path=BackcolorHex, Converter={StaticResource HexToColorConv}}"> </Setter> </Style> </telerik:RadGridView.Resources> <telerik:RadGridView.Columns> <telerik:GridViewDataColumn Header="Farbe"
CellStyle="{StaticResource CellBGStyle}" DataMemberBinding="{Binding Path=BackcolorHex, Converter={StaticResource HexToColorConv}}" IsReadOnly="True"/> </telerik:RadGridView.Columns></telerik:RadGridView>This is my converter function:
public object Convert(object value, Type targetType, object parameter, CultureInfo culture){ Brush retVal = new SolidColorBrush(Colors.White); if (value != null && value is ModelWorkflow) { myConverter conv = new myConverter(); retVal = conv.ToBrush(((ModelWorkflow)value).BackcolorHex); } return retVal; }The string is shown in the cell right. But the backcolor does not change. It's always white. Could you please tell me what i'm doing wrong?
Thank you very much.
Best regards from Germany!