Home Forums WPF controls Xceed DataGrid for WPF dataviews in DataGrids

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #26792 |

    My application is a GUI engine where the multiple UI screend are defined in XAML and Code Behind configuration file is used to map events and bindings to the controls. Before attempting to use your DataGid I was using ListViews tha were binded to dataviews that may be assocated with a data table or received data from the server. To populate the listview I created a dummy datatable with 20 columns and added the data items to each column as needed. This worked in the list view because it only showed the columns I had defined in the listview and mapped to the column in the dataview. The problem is I need a control that supports local user edits, grid lines and color control of a cell. I’m hoping your product will meet my requirements.


    Two questions 1 – I ran into the same problem as post 10931 with a hard error when moving focus from the insert row.when setting the DataGrid.ItemSource directly to the datavview. How in C# code do you assigned the dataview to the DataGridCollectionView and how in code do  you assign the DataGridCollectionView to a DataGrid control


    2 – It ther anyway to not show all the 20 columns in the dataview when I’m only populating 3 columns of data like the listview does now. I also do not want the user to see or be able to access the hidden columns 

    Imported from legacy forums. Posted by William (had 904 views)

    Xceed Support
    Post count: 5658

    1-  you can do it this way:

    //if starting from a DataTable reference.
    myDataGridControl.ItemsSource = new DataGridCollectionView( myDataTable.DefaultView );

    //directly from a DataView
    myDataGridControl.ItemsSource = new DataGridCollectionView( myDataView );

    2- You can specify to the DataGridControl NOT to create its columns automatically based on the Data Source. This can be done by specifying myDataGridControl.AutoCreateColumns = false;

    From there, you can add columns manually to the DataGridControl.Columns collection.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 1830 views)

    User (Old forums)
    Post count: 23064


    Two more questions please – I’m just a newbe

    1 If I set/leave alone AutoCreateColumns to true/default, have an InsertRow defined and set the columns I want visible things work the way I expect. I can edit the existing data and insert new data into the InsertRow. If I set the AutoCreateColumns to false and create the columns in the code the insert row is displayed but I can not entered any data. I can edit existing data.

    the code looks like this that works as expeacted

    //                m_lDataGridControl.AutoCreateColumns = false;

                       M_lDataGRidControl.Columns{“Text1”].Title = “TEST”;

                        m_lDataGridControl.Columns[“Text4”].Visible = false;


                         m_lDataGridControl.Colums{“Text20”].Visible = false;

     What does not work the way I expect is

                  m_lDataGridControl.AutoCreateColumns = false;

                   Column cColumn = new Column();

                   CColumn.Fieldname = “Text1”;

                   cColumn.Title = “TEST”;


     /*                  m_lDataGRidControl.Columns{“Text1”].Title = “TEST”;

                        m_lDataGridControl.Columns[“Text4”].Visible = false;


                         m_lDataGridControl.Colums{“Text20”].Visible = false; */

     Second question is there a way that after you press the return key in the InsertRow and enter a new row that the cell in the InsertRow is in editmode instead of the user having to select the row. The idea is to create a seamless insert process where the user can enter data into a row, tab to each cell in the row enter data, press return and continue entering data on the new blank insertion row



    Imported from legacy forums. Posted by William (had 2172 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.