Changing GridView Cell template to specific Color in Xaml
I have a Gridview, and I am binding a collection with it, Now I want to change the Color of a single column depending upon the bool value, if it is +ve then background should be Blue and If -ve then display the background as yellow. 
I tried with Data trigger, and with using converters also, But can't get the things done.

**the xaml file is** 



      <Grid.Resources>
            <Style x:Key=" ColorStyle" TargetType="{x:Type TextBlock}">
               
                <Setter Property="Text" Value="{Binding Path=CurrentPrice}"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding Path=PriceStatus}" Value="true">
                        <Setter Property="TextBlock.Background" Value="Blue"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=PriceStatus}" Value="false">
                        <Setter Property="Block.Background" Value="Yellow"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>           
        </Grid.Resources>
...
...
..
.
 <ListView ItemsSource="{Binding Collection}" SelectedItem="{Binding SelectedRow}"
                 >
            <ListView.View>
                <GridView>
                  
                    <GridViewColumn Header="Price" >
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Style="{StaticResource ColorStyle}"
                                           />
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                </GridView>
            </ListView.View>
        </ListView>

**and Using converter also.**

 public class ColorConverter : IValueConverter
    {
        
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if ((bool)value)
                return Brushes.Blue;
            else
                return Brushes.Yellow;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        
    }

**xaml file**
  <Grid.Resources>
            <Style x:Key="ColorStyle" TargetType="{x:Type TextBlock}">
                <!--<The following Setter means that the default Text of the TextBlock element is bound to the property of this object>-->
                <Setter Property="Text" Value="{Binding Path=CurrentPrice}"/>
                <!--<Style.Triggers>
                    <DataTrigger Binding="{Binding Path=PriceStatus}" Value="true">
                        <Setter Property="Control.Background" Value="Blue"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=PriceStatus}" Value="false">
                        <Setter Property="Control.Background" Value="Yellow"/>
                    </DataTrigger>
                </Style.Triggers>-->
            </Style>
            <Local:ColorConverter x:Key="ColorConverter"/>
        </Grid.Resources>
.
.
.
 <ListView ItemsSource="{Binding Collection}" SelectedItem="{Binding SelectedRow}"
                 >
            <ListView.View>
                <GridView>
                  
                    <GridViewColumn Header="Price" >
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                              <DataTemplate>
                                <TextBlock Style="{StaticResource ColorStyle}"
                                           Background="{Binding PriceStatus, Converter={StaticResource ColorConverter}}"
                                           />
                            </DataTemplate>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                </GridView>
            </ListView.View>
        </ListView>

PriceStatus is CLR boolean Property, it sets to false for -ve value of CurrentPrice.

Thanks

Changing GridView Cell template to specific Color in Xaml
===

I have a Gridview, and I am binding a collection with it, Now I want to change the Color of a single column depending upon the bool value, if it is +ve then background should be Blue and If -ve then display the background as yellow. 
I tried with Data trigger, and with using converters also, But can't get the things done.

**the xaml file is** 



      <Grid.Resources>
            <Style x:Key=" ColorStyle" TargetType="{x:Type TextBlock}">
               
                <Setter Property="Text" Value="{Binding Path=CurrentPrice}"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding Path=PriceStatus}" Value="true">
                        <Setter Property="TextBlock.Background" Value="Blue"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=PriceStatus}" Value="false">
                        <Setter Property="Block.Background" Value="Yellow"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>           
        </Grid.Resources>
...
...
..
.
 <ListView ItemsSource="{Binding Collection}" SelectedItem="{Binding SelectedRow}"
                 >
            <ListView.View>
                <GridView>
                  
                    <GridViewColumn Header="Price" >
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Style="{StaticResource ColorStyle}"
                                           />
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                </GridView>
            </ListView.View>
        </ListView>

**and Using converter also.**

 public class ColorConverter : IValueConverter
    {
        
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if ((bool)value)
                return Brushes.Blue;
            else
                return Brushes.Yellow;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        
    }

**xaml file**
  <Grid.Resources>
            <Style x:Key="ColorStyle" TargetType="{x:Type TextBlock}">
                <!--<The following Setter means that the default Text of the TextBlock element is bound to the property of this object>-->
                <Setter Property="Text" Value="{Binding Path=CurrentPrice}"/>
                <!--<Style.Triggers>
                    <DataTrigger Binding="{Binding Path=PriceStatus}" Value="true">
                        <Setter Property="Control.Background" Value="Blue"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=PriceStatus}" Value="false">
                        <Setter Property="Control.Background" Value="Yellow"/>
                    </DataTrigger>
                </Style.Triggers>-->
            </Style>
            <Local:ColorConverter x:Key="ColorConverter"/>
        </Grid.Resources>
.
.
.
 <ListView ItemsSource="{Binding Collection}" SelectedItem="{Binding SelectedRow}"
                 >
            <ListView.View>
                <GridView>
                  
                    <GridViewColumn Header="Price" >
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                              <DataTemplate>
                                <TextBlock Style="{StaticResource ColorStyle}"
                                           Background="{Binding PriceStatus, Converter={StaticResource ColorConverter}}"
                                           />
                            </DataTemplate>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                </GridView>
            </ListView.View>
        </ListView>

PriceStatus is CLR boolean Property, it sets to false for -ve value of CurrentPrice.

Thanks
