I have never used datasets, but it is a simple task with clr-objects:
public enum RowType { Ordinary, Total };
public class MyRowItem
{
public string Name { get; set; }
public int Price { get; set; }
public RowType RowType { get; set; }
}
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
var items = new List<MyRowItem>
{
new MyRowItem{Name="Jack White", Price = 2500, RowType=RowType.Ordinary},
new MyRowItem{Name="John Black", Price = 3000, RowType=RowType.Ordinary}
};
items.Add(new MyRowItem { Name = null, Price = items.Sum(i => i.Price), RowType = RowType.Total });
this.DataContext = items;
}
}
Xaml:
<Window.Resources>
<DataTemplate x:Key="priceTemplate">
<TextBlock x:Name="priceText" Text="{Binding Price}" Margin="-1"/>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding RowType}" Value="Total">
<Setter Property="Background" TargetName="priceText" Value="Red"/>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</Window.Resources>
<DataGrid AutoGenerateColumns="False" ItemsSource="{Binding}">
<DataGrid.Columns>
<DataGridTextColumn Header="ФИО" Binding="{Binding Name}"/>
<DataGridTemplateColumn Header="Цена" CellTemplate="{StaticResource priceTemplate}"/>
</DataGrid.Columns>
</DataGrid>
However, I recommend you to show total sum in separate TextBlock.