Is there an equivalent to the ConditionValueAppearance that exisits in the InfragisticsWinGrid?
Further update, I created a property on my business object that does the column comparison and then use a bool to brush converter to set the CellValuePresenter background.
Ok so once I change the target type of the style this worked:
RedStyle.TargetType = typeof(ValueEditor); RedStyle.Setters.Add(new Setter(ValueEditor.BackgroundProperty, System.Windows.Media.Brushes.Firebrick)); RedStyle.Setters.Add(new Setter(ValueEditor.ForegroundProperty, System.Windows.Media.Brushes.Ivory)); RedStyle.Setters.Add(new Setter(ValueEditor.FontWeightProperty, FontWeights.Bold));
BUT it still doesn't call each time the data changes.
Also, this grid is readonly so it's no that logical that I have to set the EditorStyle - which is why I was playing with CellValuePresenter as it says in the doc.
Actually that is the kind of thing I want to do but it doesn't work:
_grid.InitializeRecord += new EventHandler<Infragistics.Windows.DataPresenter.Events.InitializeRecordEventArgs>(_grid_InitializeRecord);
RedStyle.TargetType = typeof(CellValuePresenter); RedStyle.Setters.Add(new Setter(CellValuePresenter.BackgroundProperty, System.Windows.Media.Brushes.Firebrick)); RedStyle.Setters.Add(new Setter(CellValuePresenter.ForegroundProperty, System.Windows.Media.Brushes.Ivory)); RedStyle.Setters.Add(new Setter(CellValuePresenter.FontWeightProperty, FontWeights.Bold));
private void _grid_InitializeRecord(object sender, Infragistics.Windows.DataPresenter.Events.InitializeRecordEventArgs e) { CellFormatters.FormatValue1Cell(e.Record as DataRecord); }
public static void FormatValue1Cell(DataRecord record_) { if (record_ != null) { IData item = record_.DataItem as IData; if (item.Value1.HasValue && item.Value1 < item.Value2) { record_.Cells["Value1"].EditorStyle = RedStyle; } } }
This never sets the value to the specified style.
I also tried this:
CellValuePresenter valuePresenter = CellValuePresenter.FromRecordAndField(record_, record_.Cells["Value1"].Field); valuePresenter.Style = RedStyle;
But that doesn't work either because CellValuePresenter.FromRecordAndField always returns null.
Finally, InitializeRecord only gets called once....I need it to evaluate the style every time the data changes. I can't use a Converter as I need to compare two values and inside the converter you don't have access to the grid/row/cell being updated.
Hello,
Yes, Convertes in WPF are an equivalent. They are used when binding data.
http://community.infragistics.com/forums/p/20644/80133.aspx#80133
Is this what you have in mind?
Alex.