I am working on a WPF application that has one Window.xaml, where I use a dataGrid that is populated from a database (MSSQL 2008R2). In this dataGrid, I load orders from my database.
I also group my orders with numberOfOrder, and you can expand or collapse it if there are many orders at the same time.
Anyway, inside my expander there is a DockPanel that has a textBlock, I used this textBlock to display the number of each order from the database, but I wonder how I can display something else from the database in this text block (for example, I want to display DateTime when I inserted my order into the database - I have this property allready), let everything, grouped by the number of orders, allow me to display something else instead of numberOfOrder, as I did until now.
Here is a photo of what it looks like now:

Order number: # 1 <- I show this in a TextBlock, and 1 is the OffOrder number from my database.
<TextBlock FontWeight="Normal" FontFamily="Verdana" FontSize="20" Height="25" Foreground="#83D744" Text="{Binding Path=Name,StringFormat= Number of Order:# {0}}" />
And I would like to do here to display something else instead of Order Number, since I said that I would like to show DateTime, possibly anything, so I would do this:

Here is the complete code:
XAML: (TextBlock value is important here)
<DataGrid.GroupStyle> <GroupStyle> <GroupStyle.ContainerStyle> <Style TargetType="{x:Type GroupItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type GroupItem}"> <Expander IsExpanded="True" Background="Black" Opacity="0.7"> <Expander.Header > <DockPanel Height="50" Margin="0,0,0,0" Name="dockPanel" Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGrid}}, Path=ActualWidth}"> <Button>...</Button> <Button>...</Button> <TextBlock FontWeight="Normal" FontFamily="Verdana" FontSize="20" Height="25" Foreground="#83D744" Text="{Binding Path=Name,StringFormat= Number of Order:# {0}}" /> </DockPanel> </Expander.Header> <Expander.Content> <ItemsPresenter /> </Expander.Content> </Expander> </ControlTemplate> </Setter.Value> </Setter> </Style> </GroupStyle.ContainerStyle> </GroupStyle> </DataGrid.GroupStyle>
MY CLASS WHICH IS USED TO FILL DATAGRID:
public class OrderLocal { public string Title { get; set; } public int Quantity { get; set; } public int NumberOfOrder { get; set; } public DateTime DateOfInput { get; set; } }
CODE FOR WHERE I FILL DATAGRID WILL BE ALL ORDERS:
public MainWindow() { InitializeComponent(); this.WindowStartupLocation = WindowStartupLocation.CenterScreen; this.WindowState = WindowState.Maximized; var ordersList = OrdersController.localOrders(); collectionViewSource.Source = ordersList; collectionViewSource.GroupDescriptions.Add(new PropertyGroupDescription("NumberOfOrder")); DataContext = collectionViewSource; }