Current filter:
                                You should refresh the page.
                                Support Center
                                0

                                This example demonstrates how to bind GridControl's selected rows to a property in ViewModel in a MVVM-based application. The SelectionAttachedBehavior helper class used in this sample, provides a bindable SelectedItemsSource property, that can be used to define selection at the ViewModel level.

                                Note, we made the SelectionAttachedBehavior class as generic as possible, and the same approach can also be used for other controls that support multiple selection. This example demonstrates how this can be done when working with the standard ListBox control, as well as with the standard DataGrid.

                                • S Sharma 12.18.2012

                                  Hi

                                  I am using this procedure to preserve selected rows for the WPF GridControl, but as we are updating the grid with new data in a timer, the selected rows are still getting lost. Please suggest how should we modify this sample so as to preserve grid selected rows even between the updates (like same selected rows should be present after the grid is updated with new data in a separate thread). Also, We are using a NavigationStyle=Cell, so just wanted to also check if we need to change the NavigationStyle to Row for your below sample to work with grid updates?

                                  Thanks

                                • Vidhyadhar Dhumal 03.25.2014

                                  In this example how to avoid multiple selection of rows. Our requirement is user should not be able to select mutiple rows. only single row should be allowed ro select. Hope this clarifies our requirement.

                                You must  log in  or  register  to leave comments
                                Show Implementation Details
                                Select file
                                • MainPage.xaml
                                • MainPage.xaml.cs
                                • MainWindow.xaml
                                • MainWindow.xaml.cs
                                • ViewModel.cs
                                Select language
                                • C#
                                • VB.NET
                                Select version
                                • v2013 vol 1.4 - v2014 vol 1.5
                                • v2012 vol 1.6 - v2012 vol 2.17
                                • v2011 vol 1.5 - v2011 vol 1.12
                                • v2010 vol 2.6 - v2010 vol 2.11

                                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