Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • I’m using EF 4.0. I’ve got fluent API mapping between my model and database. In one of small utility applications I want just to display my entities as a table, so I can add/edit/delete records from the WPF user interface using DevExpress Grid control.

                                    I followed the video http://tv.devexpress.com/#DXGridWPFBindEF4 and now I see my data in the grid, but I can’t edit it.



                                    	
                                    [C#]
                                    control.gridUsers.ItemsSource = new LinqServerModeSource { ElementType = typeof (User), KeyExpression = "Login", QueryableSource = control._dbContext.Users };

                                    

                                    Is there any way of making this binding working in both ways?
                                    Thanks

                                You must  log in  or  register  to leave comments

                                1 Solution

                                1

                                The LinqServerModeSource you're using is a readonly source. Just assign an entity to the GridControl's ItemsSource property (just the way you would with a standard DataGrid or ListBox) to get the functionality you're looking for.

                                Show all comments
                                • Bashir Magomedov 11.05.2012

                                  Thanks it works. I can modify my data now and all changes go to the database when I call SaveChanges method. It is still not clear how to add a new row or delete an existing one. As there is no context menu or relevant buttons/toolbar in the grid. I remember we could add/remove rows in DxGrid for WinForms. Am I missing anything?

                                • I'm afraid our WPF GridControl doesn't provide a built-in embedded navigator like WinForms one does. You can use methods (AddNewRow, DeleteRow) or the DeleteFocused Row command (there is no command for adding a new row). Please take a look at the Deleting Rows, TableView.AddNewRow Method, and Commands help topic to learn more.
                                  I would like to add that we're working on the example that will illustrate how to add an embedded navigator to WPF GridControl. The example will be available soon.

                                • Bashir Magomedov 11.05.2012

                                  Hi Ted. Thanks a lot for your help. I’ve checked your links and managed to add required functionality into my grid. I just set NewItemRowPosition="Top" property for my table view xaml (to add new rows) and added RowCellMenuCustomizations with DeleteFocusedRow command (to delete existing rows). It works great!

                                • You're welcome, Bashir. I am happy to hear that my assistance was helpful to you.

                                • Hello Bashir,

                                  I just wanted to inform you that we finished an example illustrating how to add an embedded navigator to WPF GridControl, just like in WinForms. You will find this example by this link - E4347: How to add an embedded DataNavigator to GridControl via an attached behavior.

                                • Rodrigo Gutierrez 11.08.2012

                                  Hello, could you please give an example in C# of how to post the changes from the DxGrid control to the database using Entity Framework.

                                • Hi Rodrigo,

                                  Thank you for your response. Please take a look at the following Code Central example: How to implement CRUD operations using DXGrid and Entity Framework.

                                  P.S. I would like to ask you not to post several problems in the same ticket as it may cause misunderstanding when different support engineers process your inquiry. Please open a new issue for each question you wish to ask.

                                You must  log in  or  register  to leave comments

                                To start a chat you should create a support ticket


                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners