We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

FilterBar Dissapears when hosted in a docking panel

I have a GridDataBoundGrid with a filter bar. It has always worked fine. Now I have started using an open-source dockable panel project - http://sourceforge.net/projects/dockpanelsuite/. When I put my GridDataBoundGrid into the panel I get the following behaviour: 1) When the application starts up the panel is shown and the grid has the fully working filter bar. However the AutoSize of the columns has not worked. 2) I hide and reshow the grid. The grid now has correctly auto-sized columns, but the filter bar has dissapeared. However if I then reset the filter then the filter row appears, but there are no drop down boxes! No exceptions are thrown by Syncfusion (or any other component). Do you have any idea what could make the filter bar so temperamental? Also, would I be better off implementing a normal virtual grid with a dataview behind it, and writing my own filter bar?, or is this effectively what GridDataBoundGrid does?!! Thanks Charlie private void AddFilterBar() { // Unwire any previous grid if (_filterBar != null) _filterBar.UnwireGrid(); //create the filter bar and display it _filterBar = new GridFilterBar(); //catch the creating column header event so we can turn off unwanted filter headers //needs to be hooked before WireGrid call to catch things... this.CurrentCellShowingDropDown +=new GridCurrentCellShowingDropDownEventHandler(DataBoundGrid_CurrentCellShowingDropDown); _mnuFilterBar = new ContextMenu(); _mnuFilterBar.MenuItems.Add("Reset Filter", new EventHandler(ResetFilter_Click)); this.CellClick +=new GridCellClickEventHandler(DataBoundGrid_CellClick); // the below implements auto-complete. Uncomment the line below, and re-comment the remaining // lines if this paragraph to have the default behaviour. //_filterBar.WireGrid(this); GridStyleInfo style = new GridStyleInfo(); style.ModifyStyle(this.BaseStylesMap["Header"].StyleInfo, Syncfusion.Styles.StyleModifyType.Copy); style.CellType = "ComboBox"; style.ExclusiveChoiceList = true; style.BaseStyle = "Standard"; style.Font.Bold = false; style.BackColor = this.TableStyle.BackColor; style.Borders.Bottom = new GridBorder(GridBorderStyle.Dashed); style.DropDownStyle = GridDropDownStyle.AutoComplete; style.AutoSize = true; _filterBar.WireGrid(this as Syncfusion.Windows.Forms.Grid.GridDataBoundGrid, style); }

1 Reply

AD Administrator Syncfusion Team April 11, 2005 09:35 AM UTC

I do not know how this docking framework works, but in a lot of cases, Docking frameworks dynamically swap out the parent of the window being docked. And when a parent of a control is nuked, the underling BindingContext which manages all the databinding for that control is also nuked. So, I suspect this is what is going on. If there is some kind of DockStateChanged event in this framework, then you can try putting all the databinding initalization code in this event so that the databinding is reset to your requirements each time the dock manager changes the dockstate. Sometimes all that is necessary is to create a form class level member that holds a fixed binding context. Then during initial form creation, create a BindingCOntext and save it in this form member. Then immediatly after creeating the GridDataBoundGrid, set grid.BindinContext to the form level member. Also, in the ''DockStateChanged'', reset the grid.BindingContext back to the same form member. This way, you will always be sure the grid is using the same bindingcontext. But this may not be sufficient if you are loosing things like columns and filterbars. In particular for the filterbar, you should probably unwire it before the docking manager changes the dockstate and then rewire it afterwards.

Live Chat Icon For mobile
Up arrow icon