Highlighted
Outstanding Contributor.
Outstanding Contributor.
11260 views

DataGrid.RowDetailsTemplate

Jump to solution

Hello

I'm trying to see the details of the invoices when I select the line of one of them.
For this I created a datagrid with invoices.
After I added a DataGrid.rowdetailstemplate where i define the fields i want to appear when I select an invoice.
When I select one of them with the header line appears but the invoice lines do not appear.

I've tried several ways and I can't get them to appear.
I don't know exactly when and how you have to load the information of the details.

Can someone help me?
Thank you.

0 Likes
3 Solutions

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: DataGrid.RowDetailsTemplate

Jump to solution

Here is an updated sample that has added a second grid as part of the details on the rows of the first grid. I just created a list containing the data as a new property of the same object that I was binding. In a real application you would most likely get this data from a file or database as a DataSet object and bind directly to that.

View solution in original post

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: DataGrid.RowDetailsTemplate

Jump to solution

Try something like:

if not type Decimal::TryParse(fldDescr1::Text, BCL-DESC)

  *> invalid numeric data

  move 0 to BCL-DESC

end-if

View solution in original post

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: DataGrid.RowDetailsTemplate

Jump to solution

Hi

Define a MaxHeight property for the second datagrid

...

           <DataGrid.RowDetailsTemplate>

               <DataTemplate>

                 <DataGrid

                    x:Name="ordGrid"

                    MaxHeight="200"

                    ItemsSource = "{Binding Path = custOrders}"

...

So if necessary a separate scrollbar will be created for the second datagrid

Regards

Werner Lanter

View solution in original post

0 Likes
29 Replies
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: DataGrid.RowDetailsTemplate

Jump to solution

Sorry. My problem is with WPF

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: DataGrid.RowDetailsTemplate

Jump to solution

Example to select the object with the row values:

           <DataGrid Name="DGWerte"

                 Margin="10,0,0,0"

                 AutoGenerateColumns="False"

                 CanUserAddRows="True"

                 CanUserDeleteRows="True"

                 CanUserReorderColumns="False"

                 CanUserSortColumns="True"

                 CanUserResizeColumns="True"

                 CanUserResizeRows="False"

                 IsSynchronizedWithCurrentItem="True"

                 SelectionMode="Single"

                 SelectionUnit="FullRow"

                 GridLinesVisibility="All"

                 ToolTip="Tooltip: Delete löscht Zeile"

                 SelectionChanged="DGWerte_SelectionChanged"

                 CellEditEnding="DGWerte_CellEditEnding"

                 Background="White">

               <DataGrid.Columns>

                                ….

      method-id DGWerte_CellEditEnding.

      procedure division using by value sender as object e as type System.Windows.Controls.DataGridCellEditEndingEventArgs.

          if DGWerte::SelectedIndex >= 0

              set GridZeile to DGWerte::Items::CurrentItem as type WPFApplDataGrid.GridZeile

          end-if.

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: DataGrid.RowDetailsTemplate

Jump to solution

Thanks for your answer bau my problem is not receive the data selected.

I try to make an example of a gridview contain the invoices of a client. It's OK.

Now i want to expand the gridview to see (inside the grig view) the lines of the invoice.

I can see the header of the details but i can't see the lines.

I don't know how i can send you a print to explain wath i want to do.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: DataGrid.RowDetailsTemplate

Jump to solution

I have attached a real simple example of using a dataGrid with a rowsDetailTemplate that works for me.

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: DataGrid.RowDetailsTemplate

Jump to solution

Thanks for the example. It is the simplest to load the data in the datagrid that I saw.

I get the programming scheme.

Now what I was trying to do that but with multiple detail lines for each customer.

The better I got to explain is what's in Figure 8 this link

www.linhadecodigo.com.br/.../usando-a-datagrid-wpf.aspx

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: DataGrid.RowDetailsTemplate

Jump to solution

The multiple row approach appears to be done by embedding a second grid within the RowsDetailTemplate. I will work on modifying the example I gave to you to support this.

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: DataGrid.RowDetailsTemplate

Jump to solution

Ok. Thanks for your help.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: DataGrid.RowDetailsTemplate

Jump to solution

Here is an updated sample that has added a second grid as part of the details on the rows of the first grid. I just created a list containing the data as a new property of the same object that I was binding. In a real application you would most likely get this data from a file or database as a DataSet object and bind directly to that.

View solution in original post

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: DataGrid.RowDetailsTemplate

Jump to solution

It's perfect and work well.

Thanks again.

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: DataGrid.RowDetailsTemplate

Jump to solution

Just more one thing:

In your example I added a column with the value of each order (it's ok).

I tried to use the STRINGFORMAT = N02 (or another) but appears always the same (without any format).

You can use your last example and apply the StringFormat?

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: DataGrid.RowDetailsTemplate

Jump to solution
Have a look to my solution
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.