Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5956501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:15:57+00:00 2026-05-22T18:15:57+00:00

I have Infragistics XamDataGrid and in it, there are few columns which show data

  • 0

I have Infragistics XamDataGrid and in it, there are few columns which show data in percentage.

Now I want these columns to show the value as percentage and Background as a 2-color gradient, in which 1st color would be binded to the percentage value, and 2nd color would the left over value.

The workaround for this is Templating cellvaluepresenter, through which you can do styling on a Cell.

You can create a style with TargetType=”{x:Type igDP:CellValuePresenter}”.

But now the question arises that how can I decide what value is coming from the backend and show the background on the basis of value.

Following is the code. In this code when I use StaticResource in CellValuePresenterStyle. The binding is working fine, but converter in the style is not called. When I use DynamicResource in CellValuePresenterStyle, the Binding breaks and the values in the column are empty.

<igDP:XamDataPresenter x:Name="xamDataPresenter1" Height="300" DataSource="{Binding DV}"    >
        <igDP:XamDataPresenter.FieldLayoutSettings>
            <igDP:FieldLayoutSettings AutoGenerateFields="True" HeaderPrefixAreaDisplayMode="FieldChooserButton" 
                                      />
        </igDP:XamDataPresenter.FieldLayoutSettings>

        <igDP:XamDataPresenter.FieldLayouts>
            <igDP:FieldLayout>
                <igDP:FieldLayout.FieldSettings>
                    <igDP:FieldSettings CellClickAction="SelectCell" AllowEdit="False" />
                </igDP:FieldLayout.FieldSettings>
                <igDP:FieldLayout.Fields>
                    <!--<igDP:UnboundField Name="ProductID" Label="Product ID" />-->
                    <igDP:Field Name="LocationID" DisallowModificationViaClipboard="True" >
                        <igDP:Field.Settings>
                            <igDP:FieldSettings CellValuePresenterStyle="{DynamicResource myCustomFieldCell}"/>
                        </igDP:Field.Settings>
                    </igDP:Field>
                    <!--You can add more Field objects here-->
                </igDP:FieldLayout.Fields>
            </igDP:FieldLayout>
        </igDP:XamDataPresenter.FieldLayouts>           
    </igDP:XamDataPresenter>

Code for Style

 <local:StringToDoubleConverter x:Key="stringToDoubleConverter" />


    <Style x:Key="myCustomFieldCell" TargetType="{x:Type igDP:CellValuePresenter}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
                    <Grid>                                         
                        <Border Panel.ZIndex="0" Width="{Binding ElementName=textBlock,Path=Text,Converter={StaticResource stringToDoubleConverter}}" HorizontalAlignment="Left">
                            <Border.Background>
                                <LinearGradientBrush>
                                    <GradientStop Color="Red" Offset="0" />
                                    <GradientStop Color="Transparent" Offset="1" />
                                    <GradientStop Color="White" Offset=".99" />
                                </LinearGradientBrush>
                            </Border.Background>
                        </Border>
                          <TextBlock Panel.ZIndex="1"
                                Width="Auto"
                                Height="Auto"
                                Text="{TemplateBinding Content}"                                                                         
                                HorizontalAlignment="Center"
                                Margin="5,0,0,0"                                       
                                VerticalAlignment="Center"                                  
                                x:Name="textBlock" />
                    </Grid>                      
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

Can anyone give any workaround for this.

Thanks,

VJ

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:15:58+00:00Added an answer on May 22, 2026 at 6:15 pm

    Everything in the above code is right, just change the style with the below code.

    <Style x:Key="myCustomFieldCell" TargetType="{x:Type igDP:CellValuePresenter}">
            <Setter Property="OverridesDefaultStyle" Value="True"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
                        <Grid>                            
                            <ContentPresenter Panel.ZIndex="1"                                  
                                    Content="{TemplateBinding Content}"                                                                      
                                    HorizontalAlignment="Center"
                                    Margin="5,0,0,0"                                       
                                    VerticalAlignment="Center"                                  
                                    x:Name="contentPresenter" />
                            <Border Panel.ZIndex="0" Width="{Binding ElementName=contentPresenter, Path=Content, Converter={StaticResource stringToDoubleConverter}}" HorizontalAlignment="Left">
                                <Border.Background>
                                    <LinearGradientBrush>
                                        <GradientStop Color="Red" Offset="0" />
                                        <GradientStop Color="Transparent" Offset="1" />
                                        <GradientStop Color="White" Offset=".99" />
                                    </LinearGradientBrush>
                                </Border.Background>
                            </Border>
                        </Grid>                        
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using the Infragistics UltraWebGrids for a few years now in multiple
i have an Infragistics carousel control which i want to call next on every
I am using the Infragistics UltraWebGrid to capture some data. I don't have this
We have a Infragistics xamDataGrid with the DataSource bound to a BindingList. We have
further to my previous question , I have a new problem now, I want
Hi We have to bind the data in web infragistics hiergrical control. so we
I have an infragistics UltraWinGrid and I want to disable the first column or
I have a infragistics textbox . I want to remove its border. and I
I have ultraTree (infragistics tree) which is created at design time and it has
We are currently an Infragistics NetAdvantage Select customer and have been for a few

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.