Telerik Forums
UI for WinForms Forum
5 answers
233 views
Hi, my intention is to display a RadcontextMenu on a RadListControl when a mouse right-button is pressed or released (depending on the ClickMode configuration of the RadListControl).

I just would like to threat a right-button click in the same way as a left-button click is threated by default in a  RadListControl, but I don't know whether Telerik provides a way to do this just by setting an specific property or somethins similar, what I'm doing is iterating the RadListControl items and determine which item contains the current mouse location but maybe this is a heavy method for big list item collections.

Pleasse. could you check my approach to see if it can be improved/simplified in some way via Telerik?

Also, I have an unsolved problem, in the line 96 of the code below I would like to determine which radListControl called the RadContextMenu to retrieve its SelectedItem.Text property, but I don't know if its possibly.

Thanks in advance.

001.Option Strict On
002.Option Explicit On
003.Option Infer Off
004. 
005.Imports Telerik.WinControls
006.Imports Telerik.WinControls.Enumerations
007.Imports Telerik.WinControls.UI
008. 
009.Public Class RadContextMenu_TestForm
010. 
011.    Private Shadows Sub Load() Handles MyBase.Load
012. 
013.        ' Set the RadListControl behavior
014.        With Me.RadListControl1
015.            .SortStyle = SortStyle.Ascending
016.            .SelectionMode = SelectionMode.One
017.            .ListElement.ClickMode = ClickMode.Release
018.        End With
019. 
020.        ' Set the listRadListControl items
021.        Me.RadListControl1.DataSource =
022.            From p As Process In Process.GetProcesses
023.            Select p.ProcessName
024. 
025.    End Sub
026. 
027.    ''' <summary>
028.    ''' Shows a RAD context menu on the active <see cref="RadListControl"/> item.
029.    ''' </summary>
030.    ''' <param name="ctrl">The <see cref="RadListControl"/> control.</param>
031.    ''' <param name="ctxm">The <see cref="RadContextMenu"/> to show.</param>
032.    Private Sub ShowRadContextMenu(ByVal ctrl As RadListControl,
033.                                   ByVal ctxm As RadContextMenu)
034. 
035.        For Each Item As RadListDataItem In ctrl.Items
036. 
037.            If Item.VisualItem IsNot Nothing AndAlso Item.VisualItem.IsMouseOverElement Then
038.                Item.Selected = True
039.                ctxm.Show(MousePosition)
040.            End If
041. 
042.        Next Item
043. 
044.    End Sub
045. 
046.    ''' <summary>
047.    ''' Handles the MouseDown event of the RadListControl1 control.
048.    ''' </summary>
049.    ''' <param name="sender">The source of the event.</param>
050.    ''' <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param>
051.    Private Sub RadListControl1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) _
052.    Handles RadListControl1.MouseDown
053. 
054.        Dim ctrl As RadListControl = DirectCast(sender, RadListControl)
055. 
056.        If (e.Button = Windows.Forms.MouseButtons.Right) _
057.        AndAlso (ctrl.ListElement.ClickMode = ClickMode.Press) Then
058. 
059.            Me.ShowRadContextMenu(ctrl, Me.RadContextMenu1)
060. 
061.        End If
062. 
063.    End Sub
064. 
065.    ''' <summary>
066.    ''' Handles the MouseUp event of the RadListControl1 control.
067.    ''' </summary>
068.    ''' <param name="sender">The source of the event.</param>
069.    ''' <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param>
070.    Private Sub RadListControl1_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) _
071.    Handles RadListControl1.MouseUp
072. 
073.        Dim ctrl As RadListControl = DirectCast(sender, RadListControl)
074. 
075.        If (e.Button = Windows.Forms.MouseButtons.Right) _
076.        AndAlso (ctrl.ListElement.ClickMode = ClickMode.Release _
077.                 OrElse
078.                 ctrl.ListElement.ClickMode = ClickMode.Hover) Then
079. 
080.            Me.ShowRadContextMenu(ctrl, Me.RadContextMenu1)
081. 
082.        End If
083. 
084.    End Sub
085. 
086.    ''' <summary>
087.    ''' Handles the Click event of the RadMenuItem1 control.
088.    ''' </summary>
089.    ''' <param name="sender">The source of the event.</param>
090.    ''' <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
091.    Private Sub RadMenuItem1_AddToExclusionList_Click(ByVal sender As Object, ByVal e As EventArgs) _
092.    Handles RadMenuItem1.Click
093. 
094.        If DirectCast(e, MouseEventArgs).Button = Windows.Forms.MouseButtons.Left Then
095. 
096.            MessageBox.Show(DirectCast(RadMenuItem1.OwnerControl, RadListControl).SelectedItem.Text)
097. 
098.        End If
099. 
100.    End Sub
101. 
102.End Class
Dimitar
Telerik team
 answered on 21 Oct 2014
1 answer
162 views
Are there plans to have RadDataEntry implement the IPrintable interface so it can be used with RadPrintDocument?
George
Telerik team
 answered on 21 Oct 2014
1 answer
129 views
Hi, 

How can i catch a new added row event while the user process the adding event 

thanks
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 21 Oct 2014
2 answers
984 views
Hi,
I  have 2 columns among other columns in a radgridview: one is a textbox and the another is a button (Scan button). The user either can enter data in the textbox or can click on the scan button to get back data into the textbox. The textbox has some validation that I don't need to be triggered if the user is clicking on the Scan button but should be triggered if the user click on any other cell. How can do that as right now any validation is triggered as soon as I click on the Scan button.

Thanks, 
Ryan
Top achievements
Rank 1
 answered on 20 Oct 2014
0 answers
116 views
Hi,
I have an asp.net 4.0 application with telerik control. In My cuurent page, have radtextbox, radwindow, and update panel also. When i click on the search button, it will display the record in radwindow  in IE and mozilla. But i want to add one more new radtextbox and enter some data,and search it. it will display the data, but in IE 8 , showing an error such as expected ')' at the line 109 char 68 code 0. But it is working in Mozilla fina. how can i resolve this one.?

if u look that line also design page, it is a blank line.

Thanks
Dileep
Dileep
Top achievements
Rank 1
 asked on 20 Oct 2014
3 answers
110 views
how can i bind 2fields of sql in combobox with id?
i want "name" and "family"  bind in comobox and id as value member
can i do this?
George
Telerik team
 answered on 20 Oct 2014
1 answer
239 views
I have a set of tabbed ToolWindows that are initially hidden when my application starts.  When I hover over one of them, and then select to pin the windows, is there a way to specify the width, and/or height, that I want them to be when pinned?

Thanks.

Dimitar
Telerik team
 answered on 20 Oct 2014
1 answer
562 views
Hi, I recently installed the Telerik Winform and using the RadGrid control. I am working with a database where the values get updated every second and I have to display the updated rows to RadGrid. Before that I was using the standard DataGrid but there was lot of flicking problem on assigning the data source again to refresh it.

RadGrid is better option but I am still facing the same issue with it. I am using background worker control with Async mode queries and on Timer control I am refreshing the data
1. Clearing the dataset
2. RadGrid datasource to Nothing
2. Filling the dataset again, 
4.and assigning the data source to RadGrid

All the above process causing the RadGrid to flick, can you please guide me to do this is better way. Example will be appreciated.

Thank you.
Dimitar
Telerik team
 answered on 20 Oct 2014
4 answers
211 views
Hi,

I want to achieve the same 'new row behavior' as the default windows gridview.
That means that if I edit a cell in the 'new row', the row is also added to the datasource and is a 'real' row instead of a 'new row'. Now this only can be achieved by pressing enter or set the focus to another row.

Best regards
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 20 Oct 2014
4 answers
406 views
When I override Onclick on RadButton, the code first finishes the whole onclick method before firing base.OnClick.
For a standard Button, this works fine.
In the example below, the OnClick will first finish completely before the base.OnClick will be executed, but is should not.
How to fix this ?

public class QButton : RadButton
{
protected override void OnClick(EventArgs e)
{
var form = FindForm();
try
{
// set wait cursor 
form.Cursor = Cursors.WaitCursor;

// execute base click code
base.OnClick(e);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
// set arrow cursor
form.Cursor = Cursors.Default;
}
}
}

Dimitar
Telerik team
 answered on 17 Oct 2014
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)
Form
Chart (obsolete as of Q1 2013)
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
VirtualGrid
Toolstrip (obsolete as of Q3 2010)
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
SplitContainer
Documentation
Map
DesktopAlert
CheckedDropDownList
ProgressBar
MessageBox
TrackBar
Rotator
SpinEditor
CheckedListBox
StatusStrip
CollapsiblePanel
LayoutControl
ShapedForm
SyntaxEditor
Wizard
TextBoxControl
Conversational UI, Chat
DateTimePicker
TabbedForm
CAB Enabling Kit
WaitingBar
GroupBox
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
FileDialogs
ColorDialog
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
NavigationView
BindingNavigator
RibbonForm
Styling
Barcode
PopupEditor
TaskBoard
Callout
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
BreadCrumb
ButtonTextBox
FontDropDownList
BarcodeView
Overlay
Security
LocalizationProvider
Dictionary
TreeMap
StepProgressBar
SplashScreen
Flyout
Separator
SparkLine
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
SpeechToTextButton
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?