My main form loads a RadDock and a toolWindow containing a PanelBar and RadList.
On clicking items in the RadList a new DocumentWindow is opened. This window is a class which inherits from DocumentWindow.
This loads the document window
My inherited class (only some of it for brevity)
In the constructor I add controls to the document including a RadGrid. When many documents are opened I have a UI similar to VisualStudio.
My Main form has a menu containing a delete button. When this button is clicked I want to delete the current grid row on the current active window.
My difficulty is that I cannot figure out how to reference the "delete item" code in the class LogWindow:
Any help would be appreciated.
On clicking items in the RadList a new DocumentWindow is opened. This window is a class which inherits from DocumentWindow.
This loads the document window
| LogDocument documentLog = new LogDocument(); |
| documentLog.Text = documentTitle; |
| documentLog.CurrentFileId = selectedIndex; |
| documentLog.Load(); // Loads data into grid |
| AirFile.AddNewMostRecentFile(documentTitle, selectedIndex); |
| this.radDock.AddDocument(documentLog); |
My inherited class (only some of it for brevity)
| class LogDocument : DocumentWindow |
| { |
| public LogDocument() |
| { |
| AddGridToForm(); |
| } |
| public void Load() |
| { |
| LoadGridWithData(); |
| } |
| private void AddGridToForm() |
| { |
| RadTabStrip radTabStrip = new Telerik.WinControls.UI.RadTabStrip(); |
| TabItem tabGridItem = new Telerik.WinControls.UI.TabItem(); |
| TabItem tabDetailItem = new Telerik.WinControls.UI.TabItem(); |
| // |
| // radTabStrip1 |
| // |
| radTabStrip.AutoScrollMargin = new System.Drawing.Size(0, 0); |
| radTabStrip.AutoScrollMinSize = new System.Drawing.Size(0, 0); |
| radTabStrip.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(191)))), ((int)(((byte)(219)))), ((int)(((byte)(254))))); |
| radTabStrip.Dock = DockStyle.Fill; |
| radTabStrip.Location = new System.Drawing.Point(0, 0); |
| radTabStrip.Name = "radTabStrip"; |
| radTabStrip.ScrollOffsetStep = 5; |
| radTabStrip.TabScrollButtonsPosition = Telerik.WinControls.UI.TabScrollButtonsPosition.RightBottom; |
| radTabStrip.Text = "radTabStrip"; |
| // |
| // tabGridItem |
| // |
| tabGridItem.Alignment = System.Drawing.ContentAlignment.BottomLeft; |
| // |
| // tabItem1.ContentPanel |
| // |
| tabGridItem.ContentPanel.BackColor = System.Drawing.Color.Transparent; |
| tabGridItem.ContentPanel.CausesValidation = true; |
| tabGridItem.IsSelected = true; |
| tabGridItem.Margin = new System.Windows.Forms.Padding(4, 0, 0, 0); |
| tabGridItem.Name = "tabGridItem"; |
| tabGridItem.StretchHorizontally = false; |
| tabGridItem.Text = "Grid"; |
| // |
| // tabItem2 |
| // |
| tabDetailItem.Alignment = System.Drawing.ContentAlignment.BottomLeft; |
| // |
| // tabItem2.ContentPanel |
| // |
| tabDetailItem.ContentPanel.BackColor = System.Drawing.Color.Transparent; |
| tabDetailItem.ContentPanel.CausesValidation = true; |
| tabDetailItem.Margin = new System.Windows.Forms.Padding(4, 0, 0, 0); |
| tabDetailItem.Name = "tabDetailItem"; |
| tabDetailItem.StretchHorizontally = false; |
| tabDetailItem.Text = "Item Detail"; |
| // TODO |
| // Add controls to show current row details in a form |
| grid.Dock = DockStyle.Fill; |
| grid.RowsChanged += new Telerik.WinControls.UI.GridViewCollectionChangedEventHandler(GridRowsChanged); |
| grid.DoubleClick += new System.EventHandler(GridDoubleClick); |
| // |
| // Add TabItems to TabStrip |
| // |
| radTabStrip.Items.AddRange(new Telerik.WinControls.RadItem[] { tabGridItem, tabDetailItem }); |
| // |
| // Add grid to tab 1 |
| // |
| tabGridItem.ContentPanel.Controls.Add(grid); |
| // |
| // Add tab strip to form |
| // |
| Controls.Add(radTabStrip); |
| } |
| /// <summary> |
| /// Persist changes to current row to database. |
| /// </summary> |
| /// <param name="sender"></param> |
| /// <param name="e"></param> |
| private void GridRowsChanged(object sender, GridViewCollectionChangedEventArgs e) |
| { |
| Save(); |
| } |
In the constructor I add controls to the document including a RadGrid. When many documents are opened I have a UI similar to VisualStudio.
My Main form has a menu containing a delete button. When this button is clicked I want to delete the current grid row on the current active window.
My difficulty is that I cannot figure out how to reference the "delete item" code in the class LogWindow:
| public void DeleteRow() |
| { |
| // Delete code here |
| // then save changes to db |
| Save(); |
| } |
Any help would be appreciated.