Hello Telerik,
I am trying to customize a RowStyle, depending on what comes from the database.
My first attempt is very simple, but I am getting this error when running
An unhandled exception of type 'System.InvalidOperationException' occurred in PresentationFramework.dll
Additional information: 'DataGridRow' TargetType does not match type of element 'GridViewRow'.
the error makes sense, since telerik GridView is something different than a DataGrid
but I am trying to implement the same approach.
I think it will be more clear when you see my code below:
<telerik:RadGridView Name="RadGridView" ItemsSource="{Binding View}" Style="{StaticResource VitorStyle}" AutoGenerateColumns="False">
<Style x:Key="VitorStyle" TargetType="telerik:RadGridView" > <Setter Property="RowStyle"> <Setter.Value> <Style TargetType="DataGridRow"> <Style.Triggers> <DataTrigger Binding="{Binding Name}" Value="Anastacia Santana"> <Setter Property="Background" Value="Red"></Setter> </DataTrigger> <DataTrigger Binding="{Binding Name}" Value="Ana Taylor"> <Setter Property="Background" Value="DarkOrchid"></Setter> </DataTrigger> </Style.Triggers> </Style> </Setter.Value> </Setter> </Style>As a kickoff test, I would like all Anastacia Santana rows to be RED and all Ana Taylor to be DarkOrchid.
My following tests should envolve a bit wether it is true or false, or a sum result wether it is positive or negative.
Can you please show me the best way to achieve this?
as a side note, I would like to keep my XAML as clean as possible. Thus the use of the resource file
Thank you very much!