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

                                    I would like to install a ListView into a Group on the Navigation Control (under Windows at present). The reason is that we have a ToDo list in our application, showing it via the Navigation control would allow it to be available to a user all the time.

                                    So, I have successfully added a control to the NavBar through a Window Controller and have then extended that to add a GridControl bound to an XPCollection however this is of course very dirty and does not keep to XAF standards allowing the view to be modified via the Model etc.

                                    So I wouuld be very grateful for any guidance you might give on how I would get a ListView to appear in a Group in the NavBar.

                                    I have included the sample project I have been playing with using the GridControl if it is of any assistance.

                                    Many thanks

                                    John

                                • Hello John,

                                  Thanks for contacting us. I agree with you that this is a very dirty approach and you should use another solution. I suggest you utilize the standard XAF approaches to get a ListView control:

                                  [C#]
                                  protected override PopupBaseForm CreatePopupForm() { frame = Properties.Helper.Application.CreateFrame(TemplateContext.LookupControl); frame.CreateTemplate(); ILookupPopupFrameTemplate template = (ILookupPopupFrameTemplate)frame.Template; ListView listView = Properties.Helper.CreateListView(editingObject); frame.SetView(listView, null); ((Control)frame.Template).Dock = DockStyle.Fill; popupControl.Controls.Add((Control)frame.Template);
                                  This is some code from the LookupPropertyEditor class. I commented unnecessary parts and left only essential parts here.
                                  As you see, your goal is to create a new frame, create its template, create ListView, set it to the frame and then use the template's control as needed. The important thing is that in your case, you should create a frame based on the NestedFrameTemplate.
                                  Please give it a try, and let me know how this works for you.

                                  Thanks,
                                  Dennis

                                1 Solution

                                Creation Date Rating Importance Sort by
                                0

                                Many thanks Dennis, an excellent answer as ever.

                                For anyone interested here is the code that did it (from within a WindowController) and changes the ListView to use a CardView due to the space limitations:-

                                    Private Sub CreateToDoControl(ByVal group As NavBarGroup)
                                        Dim frame As Frame = Application.CreateFrame(TemplateContext.NestedFrame)
                                        frame.CreateTemplate()
                                        Dim template As IFrameTemplate = CType(frame.Template, IFrameTemplate)
                                        Dim objectSpace As ObjectSpace = Application.CreateObjectSpace
                                        Dim listView As DevExpress.ExpressApp.ListView = Application.CreateListView(objectSpace, GetType(Reminder), True)
                                        AddHandler listView.ControlsCreated, AddressOf view_ControlsCreated
                                        frame.SetView(listView, Nothing)
                                        CType(frame.Template, Control).Dock = DockStyle.Fill
                                        group.ControlContainer.Controls.Add(CType(frame.Template, Control))
                                    End Sub

                                    Private Sub view_ControlsCreated(ByVal sender As Object, ByVal e As EventArgs)
                                        Dim view As DevExpress.ExpressApp.ListView = CType(sender, DevExpress.ExpressApp.ListView)
                                        Dim grid As GridControl = CType(view.Control, GridControl)
                                        grid.MainView = New Card.CardView(grid)
                                        grid.MainView.PopulateColumns()
                                    End Sub

                                Obviously it needs a bit of work for error checking, configure the CardView, Actions etc. but we have a ListView sat comfortably in the navigation bar.

                                Thanks again

                                John

                                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, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

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