How do I create an alternate record background for a CellValuePresenter Style?I tried creating it via a Style Trigger as so:<Style x:Key="myCell" TargetType="igDP:CellValuePresenter"> <Setter Property="Background" Value="LightGray" /> <Style.Triggers> <Trigger Property="IsAlternate" Value="True"> <Setter Property="Background" Value="Green" /> </Trigger> <Trigger Property="IsAlternate" Value="False"> <Setter Property="Background" Value="LightGray" /> </Trigger> </Style.Triggers> </Style>When scrolling, the alternate rows show up, but they are not consistent .. some colors are grouped together, rather than being every other row. The alternate rows do not show up at all when the grid is first loaded.
Hello Joseph,
I have been looking into your issue and have to say that this is not the intended way of coloring the alternate Records. Here is xaml snippet showing how you can easily assign these colors by styling the DataRecordCellArea:
<Style TargetType="{x:Type igDP:DataRecordCellArea}">
<Setter Property="Background" Value="Gray"/>
<Setter Property="BackgroundAlternate" Value="Green" />
<Setter Property="BorderBrush" Value="Blue" />
<Setter Property="BorderAlternateBrush" Value="Yellow"/>
</Style>
If there is a reason you need to do this using the CellValuePresenter please let me know what it is I can provide you with a more specific solution.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support
I posted under the wrong username before, please excuse the change.Initially, the Background is defaulted to alternate, in the way that you are describing.I am using the CellValuePresenter Style to set the style of some fields which are being added programatically, if needed. They are a different color than the normal columns. e.g.,<Style x:Key="historyCell" TargetType="igDP:CellValuePresenter"> <Setter Property="Foreground" Value="Black" /> <Setter Property="Background" Value="#LightGray" /></Style>public void AddFields(FieldLayout layout){ var operation = new UnboundField {DataType = typeof(string), Name = "Operation" }; operation.Settings.CellValuePresenterStyle = (Style)Resources["historyCell"]; layout.Fields.Add(operation);}So now this column has a light gray background, but I would like to be able to alternate the colors on the rows of this column. Is there a way to accomplish this?
Hi Joseph,
I see what you mean. If you are using the AlternateRows functionality already and taken the fact that the CellValuePresenter colousr are set on top of that of the DataRecordCellArea’s, you can simply set the CellValuePresenter style for those specific colours to a partially transparent colour. This way you will be able to set the CellValuePresenter propert to identify the columns to colour and still see your alternate rows.
Please let me know if this suits your scenario.
Kind regards Petar.
That works. Thanks!