Development/WPF

[Telerik] GridView row foregroud color

Tiger Tom 2020. 6. 2. 17:07

Xaml:

<jofC:JofContentPage.Resources>

  <jofUtil:strComplateToColorConveter x:Key="comValueConverter"></jofUtil:strComplateToColorConveter>

</jofC:JofContentPage.Resources>

 

<tr:GridView JofGridView  x:Name="grdMaster>

<jofC:JofGridView.RowStyle>

  <Style TargetType="telerik:GridViewRow" >
    <Setter Property="Foreground" Value="{Binding salepinspection,Converter={StaticResource comValueConverter}}"></Setter>
  </Style>

</jofC:JofGridView.RowStyle>

 

Xaml.cs :

grdMaster.ItemsSource = dtMaster.DefaultView;

grdMaster.AlternationCount= dtMaster.RowCount+1;

 

Class : strComplateToColorConveter

using Windows.Data, Windows.Media;

public class strComplateToColorConveter : IValueConverter

{

  string strValue = value.ToString();

 if (strValue == "1")

  {

     return new SolidColorBrush(Colors.Blue);

  }

return new SolidColorBrush(Colors.Black);

}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

{throw new NotImplementedException();}