Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
645
How to change background color in xamGrid
posted

Hi There,

I use xamGrid to display some pnl number and based on value background color of cell should be red or green. I know how to do in XamDataGrid,

=============================

<igDP:XamDataGrid x:Name="_dataGrid" Theme="[Current]">

      <igDP:XamDataGrid.FieldLayouts>
               <igDP:FieldLayout>

                  <igDP:Field Name="TodaysPnl" Label="TodaysPnl" Width="110" >
                        <igDP:Field.Settings>
                            <igDP:FieldSettings>
                                <igDP:FieldSettings.CellValuePresenterStyle>
                                    <Style TargetType="{x:Type igDP:CellValuePresenter}">
                                        <Setter Property="Background"
                                                    Value="{Binding Path=Cells[TodaysPnl].Value, Converter={StaticResource greaterThanZeroConverter}}">
                                        </Setter>
                                        <Setter Property="Foreground" Value="White" />
                                    </Style>
                                </igDP:FieldSettings.CellValuePresenterStyle>
                            </igDP:FieldSettings>
                        </igDP:Field.Settings>
                    </igDP:Field>

=======================================

I want to do same thing in xamGrid. I don't know how to do it. Does anyone know how can I  do it. Here is the code,

<ig:XamGrid x:Name="_dataGrid" AutoGenerateColumns="false" ColumnWidth="*"  >

.................

............

<ig:XamGrid.Columns>

       <ig:TextColumn Key="TotalTodaysPnl" FormatString="{}{0:C}">
                <ig:TextColumn.HeaderTemplate>
                    <DataTemplate>
                        <TextBlock Text="TodaysPnl" />
                    </DataTemplate>
                </ig:TextColumn.HeaderTemplate>
                <!--<ig:TextColumn.CellStyle>
                    <Style>
                       
                        </Setter>
                    </Style>
                </ig:TextColumn.CellStyle>-->
                
            </ig:TextColumn>

</ig:XamGrid.Columns>
</ig:XamGrid>

Thanking you in advance for your help.

Nasir

Parents Reply Children