Telerik Forums
UI for WinForms Forum
6 answers
209 views
Hi Telerik Folks,

We've overridden our "ProcessKey(KeyEventArgs keys) in a customized BaseGridBehavior class that we're using.  In doing this, the default keys for selecting a block of cells (Shift + the arrow keys) are no longer working.

To overcome this we're trying to put in custom code to explicitly do the same thing.  It looks like this...

01.    public class MyGridBehavior : BaseGridBehavior
02.    {
03. 
04. 
05.        public void SelectCellBlock(GridViewCellInfo SelectedCellTopLeft,GridViewCellInfo SelectedNewCell)
06.        {
07.            this.GridControl.ClearSelection();
08. 
09. 
10.            int TopRowIndex = SelectedCellTopLeft.RowInfo.Index <= SelectedNewCell.RowInfo.Index ? SelectedCellTopLeft.RowInfo.Index : SelectedNewCell.RowInfo.Index;
11.            int BottomRowIndex = SelectedCellTopLeft.RowInfo.Index >= SelectedNewCell.RowInfo.Index ? SelectedCellTopLeft.RowInfo.Index : SelectedNewCell.RowInfo.Index;
12. 
13.            int LeftColumnIndex = SelectedCellTopLeft.ColumnInfo.Index <= SelectedNewCell.ColumnInfo.Index ? SelectedCellTopLeft.ColumnInfo.Index : SelectedNewCell.ColumnInfo.Index;
14.            int RightColumnIndex = SelectedCellTopLeft.ColumnInfo.Index >= SelectedNewCell.ColumnInfo.Index ? SelectedCellTopLeft.ColumnInfo.Index : SelectedNewCell.ColumnInfo.Index;
15. 
16.            //this.GridControl.GridNavigator.BeginSelection(new GridNavigationContext() { InputType = InputType.Keyboard, ModifierKeys = Keys.Shift });
17. 
18.            for (int rowIndex = TopRowIndex; rowIndex <= BottomRowIndex; rowIndex++)
19.            {
20.                for (int columnIndex = LeftColumnIndex; columnIndex <= RightColumnIndex; columnIndex++)
21.                {
22.                    this.GridControl.Rows[rowIndex].Cells[columnIndex].IsSelected = true;
23.                }
24.            }
25.        }
26. 
27.        public override bool ProcessKey(KeyEventArgs keys)
28.        {
29. 
30.            if (keys.Shift && keys.KeyCode ==Keys.Down)
31.            {               
32.                GridViewCellInfo SelectedCellTopLeft = this.GridControl.SelectedCells.OrderBy(r => r.RowInfo.Index).ThenBy(c => c.ColumnInfo.Index).FirstOrDefault();
33.                this.GridControl.GridNavigator.SelectNextRow(1);
34.                GridViewCellInfo SelectedNewCell = this.GridControl.SelectedCells.OrderBy(r => r.RowInfo.Index).ThenBy(c => c.ColumnInfo.Index).FirstOrDefault();
35.                SelectCellBlock(SelectedCellTopLeft, SelectedNewCell);
36.                return false;
37.                     
38.            }
39. 
40.            if (keys.Shift && keys.KeyCode == Keys.Up)
41.            {
42.                GridViewCellInfo SelectedCellTopLeft = this.GridControl.SelectedCells.OrderBy(r => r.RowInfo.Index).ThenBy(c => c.ColumnInfo.Index).FirstOrDefault();
43.                this.GridControl.GridNavigator.SelectPreviousRow(1);
44.                GridViewCellInfo SelectedNewCell = this.GridControl.SelectedCells.OrderBy(r => r.RowInfo.Index).ThenBy(c => c.ColumnInfo.Index).FirstOrDefault();
45.                SelectCellBlock(SelectedCellTopLeft, SelectedNewCell);
46.                return false;
47. 
48.            }
49. 
50.            if (keys.Shift && keys.KeyCode == Keys.Left)
51.            {               
52.                GridViewCellInfo SelectedCellTopLeft = this.GridControl.SelectedCells.OrderBy(r => r.RowInfo.Index).ThenBy(c => c.ColumnInfo.Index).FirstOrDefault();
53.                this.GridControl.GridNavigator.SelectPreviousColumn();
54.                GridViewCellInfo SelectedNewCell = this.GridControl.SelectedCells.OrderBy(r => r.RowInfo.Index).ThenBy(c => c.ColumnInfo.Index).FirstOrDefault();
55.                SelectCellBlock(SelectedCellTopLeft, SelectedNewCell);
56.                return false;
57.            }
58. 
59.            if (keys.Shift && keys.KeyCode == Keys.Right)
60.            {
61.                GridViewCellInfo SelectedCellTopLeft = this.GridControl.SelectedCells.OrderBy(r => r.RowInfo.Index).ThenBy(c => c.ColumnInfo.Index).FirstOrDefault();
62.                this.GridControl.GridNavigator.SelectNextColumn();
63.                GridViewCellInfo SelectedNewCell = this.GridControl.SelectedCells.OrderBy(r => r.RowInfo.Index).ThenBy(c => c.ColumnInfo.Index).FirstOrDefault();
64.                SelectCellBlock(SelectedCellTopLeft, SelectedNewCell);
65.                return false ;
66.            }
67.      }
68.}


...It works, pretty much but it's performance gets exponentially slower the larger the block of cells that is selected holding down the Shift key.  It does this most likely because it loops through every cell and individually selects and flips the "IsSelected" property.

Is there a more efficient way to select blocks of cells, like using the GridNavigator.BeginSelection?  Is there a sample for using the GridNavigationContext parameter to do it this way given two cell addresses?

Are we going about this the wrong way?  Is there a more efficient way to make it opt out of our ProcessKey override and have it use the default behavior?

Thanks for any help you can provide...
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 20 Feb 2018
3 answers
159 views
How on some columns to disconnect available filter?
And in the first column, leave only containce?
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 20 Feb 2018
5 answers
1.1K+ views
I guess I am the only person who can't figure this out, but how do I programmatically set the size of a panel in the splitcontainer?  I have a form that has 2 panels and I want to be able to resize the containers on startup based on size during last use.  I have tried:
  • Setting Panel Heights
  • Setting radSplitContainer1.SplitPanels[?].Height
  • Setting radSplitContainer1.Splitters[0].Location

I am out of ideas.  Please let me know if this is possible.

Thanks,
Lee
Hristo
Telerik team
 answered on 19 Feb 2018
3 answers
135 views

Hello all telerik users,

I'm a new user of Telerik Objects and I have a problem where using a RadDropDownListItem in RadRibbonBarGroup.

In this case (Design form) the datasource property of the RadDropDownListItems is disabled. I don't understand. When I put a RadDropDownListItem elsewhere in the form this property is enabled. And of course I need it would be enabled inside a RadRibbonBarGroup.

I have to say that I'm not a C# or VB user but a Progress OpenEdgeStudio user.

 

Thanks a lot for your answers.

 

JP CLARY

Dimitar
Telerik team
 answered on 19 Feb 2018
5 answers
856 views
The radgridview that I've setup allows a user to click the delete button to delete a row.  This works well, but I'd like to prompt the user to confirm a delete.  I've tried to see if there is an event to capture the delete and allow a cancel, but it does not appear to exist.  I realize I could use a delete button, but I do not wish to use this.

Thank you in advance,
   Dennis
Dimitar
Telerik team
 answered on 19 Feb 2018
1 answer
80 views

Hi,

     I am Using Gridview. I am adding the new row in the Grid and Some Rows added Already.How do set Defualt values to Newly Added Row.

Dimitar
Telerik team
 answered on 19 Feb 2018
2 answers
72 views
The RadDock is taking so long to load the saved layout. Why does it take so long? and how do we alternatively load layout that doesn't take that long?
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 19 Feb 2018
1 answer
140 views

Hi , I am using GridviewRelation to show the tree, but my data need to be shown like this:

Id          ParentId

1                2

2                4

1                6

It means, sometimes we have the one child belong to many parents. It displays the below error, how can i fix it ?

Row with id '30' already appears in the hierarchy with parent id '27'. Each row in a self-reference hierarchy can appear only once in the hierarchy

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 19 Feb 2018
2 answers
1.0K+ views

hello everyone.i am trying create a half donut chart in my project.it has small area to dock as fill.

my problem is when i create a half donut rad chartview that view become so small.

it is look like this picture 1.There is many empty white area being and view size of charview is too much small.

but i want to make it view like at picture 2.

is that possible to create a half donut charview with bigger view size?if it is , how i can do that?I have already try change margin padding as 1px.

(this code: chart_PrimUretimi.Margin = new System.Windows.Forms.Padding(1); ) that doesn't help.

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 19 Feb 2018
1 answer
122 views

Morning,

I'm trying to embed a form that has a RadDock into my main application RadDock.  The idea is that an end user would search for a project and the project would be loaded into the main forms RadDock (rdkMain). This would allow for more than one project to be shown at any given time.  The project form could have multiple vendors which each would be loaded into the project RadDock(rdkProject).  I understand that windows will only allow for a single form to be set to IsMdiContainer.  Is there any way of doing this?

 

Thanks,

 

James

 

 

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 19 Feb 2018
Narrow your results
Selected tags
Tags
GridView
General Discussions
Scheduler and Reminder
Treeview
Dock
RibbonBar
Themes and Visual Style Builder
ChartView
Calendar, DateTimePicker, TimePicker and Clock
DropDownList
Buttons, RadioButton, CheckBox, etc
ListView
ComboBox and ListBox (obsolete as of Q2 2010)
Chart (obsolete as of Q1 2013)
Form
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
PropertyGrid
Menu
RichTextBox (obsolete as of Q3 2014 SP1)
Panelbar (obsolete as of Q2 2010)
PivotGrid and PivotFieldList
Tabstrip (obsolete as of Q2 2010)
MaskedEditBox
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
VirtualGrid
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
CheckedDropDownList
ProgressBar
TrackBar
MessageBox
Rotator
SpinEditor
CheckedListBox
StatusStrip
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
Conversational UI, Chat
DateTimePicker
CollapsiblePanel
TabbedForm
CAB Enabling Kit
GroupBox
WaitingBar
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
Styling
Barcode
BindingNavigator
PopupEditor
RibbonForm
TaskBoard
Callout
ColorBox
PictureBox
FilterView
NavigationView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
ButtonTextBox
FontDropDownList
BarcodeView
BreadCrumb
Security
LocalizationProvider
Dictionary
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
SplashScreen
ToolbarForm
NotifyIcon
DateOnlyPicker
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?