locked
How to get all values of a column in WPF? RRS feed

  • Question

  • I have this DataGrid Column:

    ParaXML

    GRP_Z_TYPE1

    GRP_Z_TYPE_1_QTY

    GRP_Z_TYPE_3

    GRP_Z_TYPE_3_QTY


    I put the values from a database into a DataGrid for editing. 

    How can I get all values of the column "ParaXML" from the DataGrid?  I have to check every value of this column.

    Thanks in advance.



    Friday, October 9, 2020 9:22 AM

All replies

  • Friday, October 9, 2020 11:30 AM
  • Hello,

    The following code sample is not MVVM so if using MVVM no need to view the code.

    In this case data is read via Entity Framework Core and know the data type of DataContext so you can iterate the collection or as shown in code (not below but in the link above) how to access the current row data.

    var employeeCollection = new ObservableCollection<Employees>();
    
    await Task.Run(async () =>
    {
        employeeCollection = new ObservableCollection<Employees>(
            await Context.Employees.ToListAsync());
    });
    
    EmployeeGrid.ItemsSource = employeeCollection;
    DataContext = employeeCollection;


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Proposed as answer by KHURRAM RAHIM Friday, November 27, 2020 5:02 PM
    Friday, October 9, 2020 1:13 PM