This is a migrated thread and some comments may be shown as answers.

[Solved] ExpressionColumn Foreground IValueConverter

7 Answers 133 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mark
Top achievements
Rank 1
Mark asked on 08 May 2011, 04:07 PM
Hi and thanks as always,

Normally when I want to paint my text color baseis negative I send it through an IValueConverter:

public class ValueToForegroundColorConverter : IValueConverter
    {
        #region IValueConverter Members        
          
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)        
        {            
            SolidColorBrush brush = new SolidColorBrush(Colors.Black);            
            Double doubleValue = 0.0;            
            Double.TryParse(value.ToString(), out doubleValue);            
            if (doubleValue < 0)                
                brush = new SolidColorBrush(Colors.Red);            
            return brush;        
        }        
          
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)        
        {            
            throw new NotImplementedException();        
        }        
          
        #endregion
    }

Can the Grid's expression column use this approach?  If not a little help please. 

7 Answers, 1 is accepted

Sort by
0
Yavor Georgiev
Telerik team
answered on 09 May 2011, 12:05 PM
Hi Mark,

 Could you please share a bit more details about your scenario? Where do you usually apply this ValueConverter? Please demonstrate a usage with an ordinary GridViewDataColumn.

All the best,
Yavor Georgiev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Mark
Top achievements
Rank 1
answered on 09 May 2011, 12:07 PM
Hi Yavor,

I'm sorry I wasn't clear.  I meant that I apply this converter on "simple" text boxes / blocks that I want to paint red when negative.  I've not used same with a GridViewColumn.

I was trying to have the same outcome within a grid, i.e. change text color to red on a negative calculated column value.  (Mind you not the cell itself).

Thanks,
Mark
0
Yavor Georgiev
Telerik team
answered on 09 May 2011, 12:18 PM
Hello Mark,

 With next week's Internal Build we will introduce a new feature - ConditionalStyleSelectors, which use Expressions such as in the ExpressionColumn. Check the telerik blogs by the end of next week for a blog post demonstrating the feature.

Best wishes,
Yavor Georgiev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Mark
Top achievements
Rank 1
answered on 09 May 2011, 12:19 PM
Fantastic - thanks so much!
0
Mark
Top achievements
Rank 1
answered on 25 Jul 2011, 04:19 PM
Hi Yavor / all,

I was just following up on this thread.  I haven't been able to find any information on implementing ConditionalStyleSelectors within the blogs.  Is that something that was finally delivered?

Many thanks,
Mark
0
Accepted
Yavor Georgiev
Telerik team
answered on 25 Jul 2011, 04:29 PM
Hi Mark,

 The conditional StyleSelector did make it for our Q2 release, but its introductory blog post is still in the pipeline. However, you can check out our online example here. I hope that it will be sufficient to get you started.

 Please don't hesitate to let me know if you need any sort of assistance in implementing this feature.

Greetings, Yavor Georgiev
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Mark
Top achievements
Rank 1
answered on 25 Jul 2011, 04:30 PM
Perfect, tyvm!
Tags
GridView
Asked by
Mark
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
Mark
Top achievements
Rank 1
Share this question
or