Telerik Forums
UI for WinForms Forum
22 answers
1.1K+ views
I'm trying to implement keyboard shortcuts for expanding and collapsing hierarchical templates via the Right and Left Arrow Keys like you can do in the Folders Pane of Windows Explorer or Outlook.  I started by inheriting the BaseGridBehavior and overriding the ProcessKey Function (like you guys had suggested for implementing Ctrl-Home/-End Keys for Top/Bottom of Grid).  The Right key works fine for Expanding a Row.  The Left key works fine for Collapsing a Row if its currently Expanded.  However, if the Current Row is not Expanded, the Left key doesn't seem to do anything.  If I set the CurrentRow.Parent.IsExpanded = False, it'll collapse the Current Template, but then it doesn't set the Current / Selected Row in the Parent Template (no Row is highlighted until I move up or down or click on a Row in the Parent Template) even if I set CurrentRow =  ParentRow, SelectedRows(0) = CurrentRow and SelectedRows(0).IsCurrent = True and call CurrentRow and SelectedRows(0)'s  InvalidateRow() and EnsureVisible() methods.  However, I'm not sure I want it to immediately collapse the Current Row's Template.  In Windows Explorer and Outlook, if the CurrentRow is not Expanded when you press Left Arrow, it simply moves the Current Row up to it's Group / Template's Parent Row.  Then you collapse that Parent Row normally when you press the Left Arrow again since it would be an Expanded Current Row at that point.

Else ' -- Not Keys.Control, .Shift or .Alt  
 
    Select Case keys.KeyCode 
 
        Case Windows.Forms.Keys.Left 
 
            If Not .MasterGridViewTemplate.AllowEditRow Then 
                ' -- If Only One Row Selected 
                If .SelectedRows.Count = 1 Then 
                    ' -- If Selected Row is Expanded 
                    If .SelectedRows(0).IsExpanded Then 
                        .SelectedRows(0).IsExpanded = False 
                        Return True 
                    Else 
                        Dim oParentRow As GridViewDataRowInfo = .CurrentRow.ViewInfo.ParentRow 
                        If oParentRow IsNot Nothing Then 
                            .CurrentRow = oParentRow 
                            'oParentRow.IsExpanded = False 
                            .SelectedRows(0) = .CurrentRow 
                            .SelectedRows(0).IsCurrent = True 
                            .SelectedRows(0).InvalidateRow() 
                            .CurrentRow.InvalidateRow() 
                            .CurrentRow.EnsureVisible() 
                            .SelectedRows(0).EnsureVisible() 
                        End If 
                        Return True 
                    End If ' -- Else Not (Selected Row is Expanded) 
                End If ' -- Only One Row Selected 
 
                ' -- Don't allow Column selection on Master Template 
                Return True 
            End If ' -- Not AllowEditRow 
 
            ' -- End Case Windows.Forms.Keys.Left 
 
        Case Windows.Forms.Keys.Right 
 
                If Not .MasterGridViewTemplate.AllowEditRow Then 
                    If .SelectedRows.Count = 1 Then 
                        .SelectedRows(0).IsExpanded = True 
                    End If 
                    Return True 
                End If ' -- Not AllowEditRow 
 
                ' -- End Case Windows.Forms.Keys.Left 
 
    End Select ' -- keys.KeyCode 
 
End If ' -- Else Not Keys.Control, .Shift or .Alt  
 

Jack
Telerik team
 answered on 19 Nov 2009
6 answers
65 views
I just installed Telerik Q3 2009 WinForms BETA (2009.2.9.1016) over Q2 2009 (2009.2.9.729) and the Up and Down keys stopped working in at least the following scenario:

  1. Click on any Row in a ChildGridViewTemplate of the MasterGiewTemplate.
  2. Switch to a Sibling (not Cousin) of that ChildGridViewTemplate,
  3. If the CurrentRow jumps up to the Parent Row of the ChildGridViewTemplate, press the Down Key to move the CurrentRow into Sibling ChildGridViewTemplate, else proceed to step 4.
  4. Pressing Up and Down Key after the 1st 0 to 1 times no longer move the CurrentRow (unless I click on another Row).

The only RadGridView change mentioned was removing separate Vertical Scroll Bars for Grids with ChildGridViewTemplates.

Telerik 2009Q3 Beta (2009.2.9.1016), VS 2005 (v8.0.50727.762 SP.050727-7600), XP SP3 on Core2Duo 2.99GHZ with 3GB.
Jack
Telerik team
 answered on 19 Nov 2009
1 answer
97 views
Hello

I'm populating a radcombobox control programatically with the code shown below. I know combo is filled with all the items it must, (i can test this using items.count or selecteditem properties), but the fact is that when I click the dropdown arrow, the combo doesn't dropdown, just stays as a single textbox showing only the current item.

This is the code sample:
 

 

 

 

Public Sub CargarMarcas(ByRef cmbMarcas As Telerik.WinControls.UI.RadComboBox)  
            Using ta As New ArqBD.dsERPConfigTableAdapters.MARCASTableAdapter  
                Using dt As New ArqBD.dsERPConfig.MARCASDataTable  
                    ta.Fill(dt)  
                    cmbMarcas.DisplayMember = "Nombre" 
                    cmbMarcas.ValueMember = "Identificador" 
                    cmbMarcas.DataSource = dt  
                End Using  
            End Using  
        End Sub 
 
   


Note: I've tried the same code in form's load event and in a separate public module (as the sample), and in both cases it doesn't work. Is there something I'm missing? Thank you in advance

 

 

 

 

 

Jorge Pascual
Top achievements
Rank 1
 answered on 19 Nov 2009
8 answers
1.0K+ views
I have a situation that I need to change the nth row's background color.  I am using the RowFormatting event as recommended.  However, I'm struggling to find the row index number. 

void tblSearchSSN_RowFormatting(object sender, RowFormattingEventArgs e)
        {
            if (e.....ROW_NUMBER = 5)
               {
                       ....do stuff....
               }
         }



This is probably a really easy one, but any help would be great! 
Thanks Ryan
Ryan
Top achievements
Rank 1
 answered on 19 Nov 2009
1 answer
278 views
I see this thread for hooking up to the DropDownOpened event and changing the size of the drop down window.

http://www.telerik.com/community/forums/winforms/combobox/dropdownwidth-and-tooltip.aspx

This is working for me, but one side effect of this change is the drop down first shows as the 'default' size then adjusts to the size it was changed to in the Event handler.

Is there anyway to avoid that flash using this technique or do I need to roll through my strings and set the DropDownWidth of the RadComboBox when I assign the DataSource to avoid the flash?

Thanks,

-Gary
Deyan
Telerik team
 answered on 19 Nov 2009
2 answers
94 views
Hi,
Please look at the picture -> formatting for cell is working, but for whole row not.

Regards
Zbyslaw Kanik
Top achievements
Rank 1
 answered on 19 Nov 2009
2 answers
110 views
Can I bind RadPanelBar use DataSource like DataSet or others in WinForms?
The RadPanelBar in Asp.Net can bind like that.  And I can't find any helps.

Does it have any way? Thank you.

Best regards

Ayumi
ayumi hinako
Top achievements
Rank 1
 answered on 19 Nov 2009
3 answers
346 views
Hello,

I have a winform GridView that I'm having a hard time changing the font size. Here is my code.

        private void radGridView1_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
        {
            Font font = new Font("Arial", 20f);
            if (e.CellElement is Telerik.WinControls.UI.GridFilterCellElement)
            {
                ((Telerik.WinControls.UI.GridViewFilteringRowInfo)e.CellElement.RowInfo).Height = 40;               
                e.CellElement.DrawFill = true;
                e.CellElement.NumberOfColors = 1;
                e.CellElement.BackColor = Color.Beige;
                e.CellElement.Font = font;
            }

I have also attached a screen-shot of my issue. Basically this changes the font size of the filter row, when the user is not in a cell typing something. But when I try to filter a column and set focus to that specific filter cell, i get a textbox in front of the "big" text with the normal 8.25 point font. What am I doing wrong?

Thanks,
Lu



Lu Pazmino
Top achievements
Rank 1
 answered on 18 Nov 2009
1 answer
102 views
I try to change RadComboBoxItems collection through casting SelectedIndexChanged event (for localization reasons). And it works fine in version 2009.2.729. But in current version 2009.3.1103 it produced exception ("Object reference not set to an instance of an object") if I change item in combobox. If I press button - all works fine.

What's wrong with that code?

Public Class RadForm1 
    Private m_cmbCurLanguage As Boolean = False 
 
    Private Sub RadForm1_Load(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles MyBase.Load 
        AssignCurLanguage(0) 
        m_cmbCurLanguage = True 
    End Sub 
 
    Private Sub AssignCurLanguage(ByVal lng As Integer
        Dim lng1 As String = "", lng2 As String = "", lng3 As String = "" 
 
        Select Case lng 
            Case 0 
                lng1 = "Eng1" : lng2 = "Ger1" : lng3 = "Fra1" 
            Case 1 
                lng1 = "Eng2" : lng2 = "Ger2" : lng3 = "Fra2" 
            Case 2 
                lng1 = "Eng3" : lng2 = "Ger3" : lng3 = "Fra3" 
        End Select 
 
        m_cmbCurLanguage = False 
 
        cmbCurLanguage.Items.Clear() 
        cmbCurLanguage.Items.Add(New Telerik.WinControls.UI.RadComboBoxItem(lng1, 0)) 
        cmbCurLanguage.Items.Add(New Telerik.WinControls.UI.RadComboBoxItem(lng2, 1)) 
        cmbCurLanguage.Items.Add(New Telerik.WinControls.UI.RadComboBoxItem(lng3, 2)) 
 
        cmbCurLanguage.SelectedIndex = lng 
    End Sub 
 
    Private Sub cmbCurLanguage_SelectedIndexChanged(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles cmbCurLanguage.SelectedIndexChanged 
        If m_cmbCurLanguage Then 
            AssignCurLanguage(cmbCurLanguage.SelectedIndex) 
            m_cmbCurLanguage = True 
        End If 
    End Sub 
 
    Private Sub RadButton1_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles RadButton1.Click 
        AssignCurLanguage(1) 
        m_cmbCurLanguage = True 
    End Sub 
End Class 
Victor
Telerik team
 answered on 18 Nov 2009
1 answer
97 views

 

Hi
I am trying to get a combobox inside the radgridview. Below code doesnt seem to work. Any help would be appreciated

   Dim farmer As New UI.GridViewComboBoxColumn()
            farmer.DataType = GetType(String)
            farmer.UniqueName = "UserID"

            farmer.HeaderText = "Farmer"
            farmer.DataSource = GetFarmerDataSource()
            farmer.DisplayMember = "UserID"
            farmer.ValueMember = "UserCode"
            farmer.FieldName = "UserID"
            farmer.Width = 150


            rgvBill.MasterGridViewTemplate.Columns.Add(farmer)


            Dim Bags As New UI.GridViewTextBoxColumn()
            Bags.DataType = GetType(Int32)
            Bags.UniqueName = "Bags"
            Bags.FieldName = "Bags"
            Bags.HeaderText = "Bags"
            Bags.Width = 50
            rgvBill.MasterGridViewTemplate.Columns.Add(Bags)


My radgrid at design time has no columns defined
Jack
Telerik team
 answered on 18 Nov 2009
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
ProgressBar
CheckedDropDownList
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
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Licensing
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
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?