or
Hi,
Could you please provide me any solution how to change selected grid view row color using Visual Style Builder.
I'd like to customize it and don't know how to handle this problem.
I was browsing it for a long time with out any result ...
Thanks in advance,
Regards.
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