Hello,
I have togive a custom behaviour to a RadGridView on the Delete or Up/Down key press.
Unfortunately, the RadGrid KeyPress doesn’t risen by the special keys.
So the only way I find to catch those keys press is to override the IsInputkey function so tomake my own control witch extends from the telerik radGrid.
public class CtrlRadGrid : Telerik.WinControls.UI.RadGridView
{
public CtrlRadGrid()
:base(){}
public delegate void InputKeyEvent(Keys keyData);
public event InputKeyEvent InputKeyOccurs = null;
protected override bool IsInputKey(KeyskeyData)
{
if (InputKeyOccurs != null)
{
InputKeyOccurs(keyData);
}
return base.IsInputKey(keyData);
}
}
All works great, my event is raised by all the keys, and all the grid keep isfunctionality… except the skin…
I think that there must be a control on the name of the class…
So is there a simple way to apply the skin on my own control witch extends from radGrid?
Is there a simple way to catch the keyPress from special keys?
| grdResults.BackColor = System.Drawing.Color.White; |
| // |
| // |
| // |
| grdResults.MasterGridViewTemplate.AddNewRowPosition = Telerik.WinControls.UI.PinnedRowPosition.Bottom; |
| grdResults.MasterGridViewTemplate.AllowAddNewRow = false; |
| grdResults.MasterGridViewTemplate.AllowColumnChooser = false; |
| grdResults.MasterGridViewTemplate.AllowDeleteRow = false; |
| grdResults.MasterGridViewTemplate.AllowEditRow = false; |
| grdResults.MasterGridViewTemplate.AllowRowResize = false; |
| grdResults.MasterGridViewTemplate.AutoGenerateColumns = true; |
| grdResults.MasterGridViewTemplate.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; |
| grdResults.MasterGridViewTemplate.EnableGrouping = false; |
| grdResults.MasterGridViewTemplate.ShowFilteringRow = false; |
| grdResults.MasterGridViewTemplate.ShowRowHeaderColumn = false; |
| grdResults.MultiSelect = true; |
| grdResults.Name = "grdResults"; |
| grdResults.ReadOnly = true; |
| grdResults.ShowGroupPanel = false; |
| grdResults.Size = new System.Drawing.Size(684, 461); |
| grdResults.TabIndex = 15; |
| grdResults.TabStop = false; |
| ((Telerik.WinControls.UI.GridTableElement)(grdResults.GetChildAt(0))).AlternatingRowColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(255)))), ((int)(((byte)(222))))); |
| ((Telerik.WinControls.UI.GridTableElement)(grdResults.GetChildAt(0))).RowHeight = 18; |
| grdResults.Size = new Size(1000, 700); |
| grdResults.DataSource = objRecordList; |
| using System; |
| using System.Collections.Generic; |
| using System.ComponentModel; |
| using System.Data; |
| using System.Drawing; |
| using System.Linq; |
| using System.Text; |
| using System.Windows.Forms; |
| using Telerik.WinControls.UI; |
| namespace TelerikGridEditing |
| { |
| public partial class Form3 : Form |
| { |
| public Form3() |
| { |
| InitializeComponent(); |
| } |
| private void bindGrid() |
| { |
| DataTable dt = new DataTable(); |
| dt.Columns.Add("ProductId"); |
| dt.Columns.Add("ProductName"); |
| dt.Columns.Add("ProductDesciption"); |
| dt.Rows.Add(1, "IPod Classic 80GB", "Description of product"); |
| dt.Rows.Add(2, "IPod Touch 32GB", "Description of product"); |
| dt.Rows.Add(3, "DishWasher", "Description of product"); |
| dt.Rows.Add(4, "Microwave Oven", "Description of product"); |
| dt.Rows.Add(5, "WashingMachine", "Description of product"); |
| dt.Rows.Add(6, "Coffee Mug", "Description of product"); |
| dt.Rows.Add(7, "Umbrella", "Description of product"); |
| GridViewDataColumn col5 = new GridViewDataColumn(); |
| radGridView1.DataSource = dt; |
| radGridView1.MasterGridViewTemplate.Columns.Add(col5); |
| } |
| private void GridLayout() |
| { |
| radGridView1.Columns[0].Width = 50; |
| radGridView1.Columns[1].Width = 100; |
| radGridView1.Columns[2].Width = 200; |
| radGridView1.Columns[3].Width = 250; |
| radGridView1.Width = 700; |
| radGridView1.MasterGridViewTemplate.Columns[0].HeaderText = "Id"; |
| radGridView1.MasterGridViewTemplate.Columns[1].HeaderText = "Name"; |
| radGridView1.MasterGridViewTemplate.Columns[2].HeaderText = "Description"; |
| radGridView1.MasterGridViewTemplate.Columns[3].HeaderText = "Order Detail"; |
| radGridView1.MasterGridViewTemplate.AllowAddNewRow = false; |
| radGridView1.MasterGridViewTemplate.EnableGrouping = false; |
| } |
| private void Form3_Load(object sender, EventArgs e) |
| { |
| bindGrid(); |
| GridLayout(); |
| this.radGridView1.CellFormatting += new CellFormattingEventHandler(radGridView1_CellFormatting); |
| } |
| void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e) |
| { |
| if (e.CellElement.RowInfo is GridViewDataRowInfo) |
| { |
| if (e.CellElement.ColumnIndex == 3) |
| { |
| int pos = 10; |
| for (int i = 0; i < 2; i++) |
| { |
| RadLabelElement lblElement = new RadLabelElement(); |
| lblElement.MaxSize = new Size(50,10); |
| lblElement.Location = new Point(5, pos); |
| lblElement.Text = "Text"; |
| e.CellElement.Children.Add(lblElement); |
| RadTextBoxElement txtElement = new RadTextBoxElement(); |
| txtElement.Text = "Blank"; |
| txtElement.MaxSize = new Size(50, 10); |
| txtElement.Location = new Point(55, pos); |
| e.CellElement.Children.Add(txtElement); |
| pos += 25; |
| } |
| int rowIndex = e.CellElement.RowIndex; |
| this.radGridView1.Rows[rowIndex].Height = pos + 10; |
| } |
| } |
| } |
| } |
| } |
I'm trying to create a simple tabbed MDI application. It won't even have dockable toolbars or anything, just a tab bar with open documents. I could do a traditional MDI, but I think that tabbed MDI is easier to use and more modern.
I would also like my application to retain the "default system" look that users are familiar with instead of using fancy color schemes and custom control styles.
How can I best achieve this? I tried the RadDock, and while it does provide the tabbed MDI part, the theming support for it is still incomplete and I can't get the standard look. I could also try to use a simple RadTabStrip, but for that I can't find any options to add a "close" button next to each item.
What would be the recommended way?