Hey,
I am trying to create a Telerik Data Grid (RadGridView) which styles each line dynamically based on some data triggers. I am using VS2019, .NET 4.6 WPF with Telerik 2019.2 NOXAML.
As I did not know how I searched the web (including this forum) and identified a basic solution. Using
<telerik:RadGridView.RowStyle>
<Style TargetType="telerik:GridViewRow">
<Setter Property="Background" Value="Red"/>
<Setter Property="Foreground" Value="White"/>
</Style>
</telerik:RadGridView.RowStyle>
I should be able to style every row red/white (for starters ...). This is from the example here (https://docs.telerik.com/devtools/wpf/controls/radgridview/styles-and-templates/styling-a-row) which is not really good because it does not tell me HOW to define it exactly on my grid. However I also found an example from the forum from 2010 (https://www.telerik.com/forums/setting-radgridview-row-background-color-based-on-the-value-of-a-column-in-the-row) which uses the styling as you see above. The example works however my grid simply shows "nothing" as soon as I use the style definition.
This is my grid which I simplified for you:
App.xml:
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Telerik.Windows.Themes.Windows8Touch;component/Themes/System.Windows.xaml"/>
<ResourceDictionary Source="/Telerik.Windows.Themes.Windows8Touch;component/Themes/Telerik.Windows.Controls.xaml"/>
<ResourceDictionary Source="/Telerik.Windows.Themes.Windows8Touch;component/Themes/Telerik.Windows.Controls.Input.xaml"/>
<ResourceDictionary Source="/Telerik.Windows.Themes.Windows8Touch;component/Themes/Telerik.Windows.Controls.GridView.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Grid.xml:
<telerik:RadGridView ItemsSource="{Binding MyObservableList}" AutoGenerateColumns="False" RowIndicatorVisibility="Collapsed">
<telerik:RadGridView.RowStyle>
<Style TargetType="telerik:GridViewRow">
<Setter Property="Background" Value="Red"/>
<Setter Property="Foreground" Value="White"/>
</Style>
</telerik:RadGridView.RowStyle>
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding idx}" Header="ID" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Description}" Header="Description" />
</telerik:RadGridView.Columns>
</telerik:RadGridView>