We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to show a databar in the background of a cell?

Hi Syncfusion Team!
We are currently trying to display a databar in the background of a column in wpf sfdatagrid while a value is in the foreground. We want to achieve a similar representation as it is possible in Excel.

Here is an excel example.
Is this possible? If so, how?
And, additionally asked, can we also create horizontally stacked bars?
kind regards,
Sascha

1 Reply

MA Mohanram Anbukkarasu Syncfusion Team November 26, 2019 01:01 PM UTC

Hi Sascha,   
  
Thanks for contacting Syncfusion support.    
  
Query   
Solution   
We are currently trying to display a databar in the background of a column in wpf sfdatagrid while a value is in the foreground. We want to achieve a similar representation as it is possible in Excel.   
  
Here is an excel example.   
Is this possible? If so, how?   
You can achieve this by using GridTemplateColumn with ProgressBar and TextBlock as DataTemplate as shown in the below code example.   
  
Code example:    
  
<syncfusion:GridNumericColumn MappingName="Quantity"   
                                      SetCellBoundValue="True"   
                                      NumberDecimalDigits="0">   
    <syncfusion:GridNumericColumn.CellTemplate>   
        <DataTemplate>   
            <Grid>   
                <ProgressBar x:Name="progressBar" Background="Transparent"     
                                     Visibility="Visible" Minimum="0" Maximum="100"      
                                     BorderThickness="0" Value="{Binding Path=Value}" />   
                <TextBlock  Text="{Binding Path=Value}" HorizontalAlignment="Right"   
                                    VerticalAlignment="Center" TextAlignment="Center"/>   
            </Grid>   
        </DataTemplate>   
    </syncfusion:GridNumericColumn.CellTemplate>   
</syncfusion:GridNumericColumn>   
  
     
  
We have prepared a sample using the above code example and it is available in the below link for your reference.    
  
  
And, additionally asked, can we also create horizontally stacked bars?   
We are not clear with this requirement. Please confirm whether you need to display as shown in the below image.    
  
     
  
Please provide more details about this requirement. It will be helpful for us to analyze and provide a prompt solution at the earliest.   
  
 
Regards,   
Mohanram A  


Loader.
Live Chat Icon For mobile
Up arrow icon