Category / Section
How to set the progress bar to a Column in Silverlight DataGrid?
2 mins read
Using GridTemplateColumn, we can load any Control as cell content for SfDataGrid with the help of CellTemplate and CellEditTemplate. CellTemplate defines how the content is displayed in the column cell and CellEditTemplate defines how the content is displayed in the column cell when in editing mode. Using CellTemplate, we can load the ProgressBar to a column and use TextBlock within CellTemplate for displaying the cell content on that ProgressBar.
The following code sample shows, how to set the ProgressBar to column using CellTemplate
XAML
<syncfusion:GridTemplateColumn MappingName="OrderID" TextAlignment="Right"> <syncfusion:GridTemplateColumn.CellTemplate> <DataTemplate> <Grid> <ProgressBar x:Name="progressBar" Background="Transparent" Visibility="Visible" Minimum="0" Maximum="200" Value="{Binding OrderID}" /> <TextBlock Text="{Binding OrderID}" HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Center"/> </Grid> </DataTemplate> </syncfusion:GridTemplateColumn.CellTemplate> </syncfusion:GridTemplateColumn>
Screenshot
Figure 1: To set the Progress Bar to a Column
Sample Links: