Thank you for reply, I adopted second way.
I followed this tutorial creating-custom-cells (same as yours).
But I dont' understand how it exposes Click event of my GridViewTextButtonColumn class.
Here my codes:
01.
Public
Class
TextButtonCellElement
02.
Inherits
GridDataCellElement
03.
04.
Public
Sub
New
(
ByVal
column
As
GridViewColumn,
ByVal
row
As
GridRowElement)
05.
MyBase
.
New
(column, row)
06.
End
Sub
07.
08.
Private
_RadTextBoxControl
As
RadTextBoxElement
09.
Private
_RadButtonElement
As
RadButtonElement
10.
11.
Protected
Overrides
Sub
CreateChildElements()
12.
MyBase
.CreateChildElements()
13.
14.
_RadTextBoxControl =
New
RadTextBoxElement()
15.
Me
.Children.Add(_RadTextBoxControl)
16.
17.
_RadButtonElement =
New
RadButtonElement
18.
_RadButtonElement.Text =
"..."
19.
_RadButtonElement.Margin =
New
Windows.Forms.Padding(0, 1, 3, 1)
20.
AddHandler
_RadButtonElement.Click,
AddressOf
_RadButtonElement_Click
21.
Me
.Children.Add(_RadButtonElement)
22.
23.
End
Sub
24.
25.
Protected
Overrides
Sub
DisposeManagedResources()
26.
RemoveHandler
_RadButtonElement.Click,
AddressOf
_RadButtonElement_Click
27.
MyBase
.DisposeManagedResources()
28.
End
Sub
29.
30.
Protected
Overrides
Function
ArrangeOverride(
ByVal
finalSize
As
SizeF)
As
SizeF
31.
If
Me
.Children.Count = 2
Then
32.
Dim
progressBarWidth
As
Single
= finalSize.Width - _RadButtonElement.DesiredSize.Width
33.
Dim
progressBarRect
As
New
RectangleF(0, 0, progressBarWidth - 1, finalSize.Height)
34.
Dim
buttonRect
As
New
RectangleF(progressBarWidth + 1, 0, _RadButtonElement.DesiredSize.Width, finalSize.Height)
35.
Me
.Children(0).Arrange(progressBarRect)
36.
Me
.Children(1).Arrange(buttonRect)
37.
End
If
38.
Return
finalSize
39.
End
Function
40.
41.
Public
Shadows
Event
Click(sender
As
Object
, e
As
EventArgs)
42.
Private
Sub
_RadButtonElement_Click(sender
As
Object
, e
As
EventArgs)
43.
RaiseEvent
Click(sender, e)
44.
End
Sub
45.
46.
Protected
Overrides
Sub
SetContentCore(
ByVal
value
As
Object
)
47.
If
Me
.Value IsNot
Nothing
AndAlso
Me
.Value IsNot DBNull.Value
Then
48.
Me
._RadTextBoxControl.Text =
CStr
(
Me
.Value)
49.
End
If
50.
End
Sub
51.
52.
Protected
Overrides
ReadOnly
Property
ThemeEffectiveType()
As
Type
53.
Get
54.
Return
GetType
(GridDataCellElement)
55.
End
Get
56.
End
Property
57.
58.
Public
Overrides
Function
IsCompatible(
ByVal
data
As
GridViewColumn,
ByVal
context
As
Object
)
As
Boolean
59.
Return
TypeOf
data
Is
GridViewTextButtonColumn
AndAlso
TypeOf
context
Is
GridDataRowElement
60.
End
Function
61.
62.
End
Class
63.
64.
Public
Class
GridViewTextButtonColumn
65.
Inherits
GridViewDataColumn
66.
Public
Sub
New
(
ByVal
fieldName
As
String
)
67.
MyBase
.
New
(fieldName)
68.
69.
End
Sub
70.
71.
Private
_GridViewRowInfo
As
GridViewRowInfo
72.
Public
Property
GridViewRowInfo()
As
GridViewRowInfo
73.
Get
74.
Return
_GridViewRowInfo
75.
End
Get
76.
Set
(
ByVal
value
As
GridViewRowInfo)
77.
_GridViewRowInfo = value
78.
End
Set
79.
End
Property
80.
81.
Public
Sub
Click(sender
As
Object
, e
As
EventArgs)
82.
Throw
New
NotImplementedException()
83.
End
Sub
84.
85.
Public
Overrides
Function
GetCellType(
ByVal
row
As
GridViewRowInfo)
As
Type
86.
87.
If
TypeOf
row
Is
GridViewDataRowInfo
Then
88.
Return
GetType
(TextButtonCellElement)
89.
End
If
90.
Return
MyBase
.GetCellType(row)
91.
92.
_GridViewRowInfo = row
93.
End
Function
94.
End
Class