This is a migrated thread and some comments may be shown as answers.

[Solved] Custom Column Checkbox Click Event

6 Answers 144 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Timothy
Top achievements
Rank 1
Timothy asked on 02 Dec 2010, 10:49 PM
I am now using a custom column class as below,

Imports System
Imports System.Net
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Documents
Imports System.Windows.Ink
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Windows.Shapes
Imports Telerik.Windows.Controls
Imports Telerik.Windows.Controls.GridView
Imports System.Windows.Controls.Primitives
  
  
Public Class CustomColumn
    Inherits GridViewDataColumn
  
  
    Public Overrides Function CreateCellElement(ByVal cell As GridViewCell, ByVal dataItem As Object) As FrameworkElement
  
        Dim cb = TryCast(cell.Content, CheckBox)
        If cb Is Nothing Then
            cb = New CheckBox()
            cb.Height = 20
            cb.SetBinding(CheckBox.IsCheckedProperty, Me.DataMemberBinding)
            cell.Content = cb
            cb.IsThreeState = True
            cell.SetBinding(GridViewCell.ValueProperty, Me.DataMemberBinding)
        End If
    
        If cell.Value = "True" Then
            cell.Background = New SolidColorBrush(Colors.Green)
        End If
  
  
        Return cb
    End Function
End Class

I need a way of calling the checkbox.Click or .Checked event for this custom column.

How can I do this?

6 Answers, 1 is accepted

Sort by
0
Timothy
Top achievements
Rank 1
answered on 03 Dec 2010, 05:24 AM
Please help. I already have a Sub Routine that I was calling successfully before I started using a custom column class But it was defined through a data template in XAML and this method will not work with a custom Column class. i really need a solution.


Thank you,

Tim
0
Timothy
Top achievements
Rank 1
answered on 03 Dec 2010, 08:33 AM
Can anyone help me. I have been scouring the forums all day and I cant find a solution.

Thanks,
Tim
0
Maya
Telerik team
answered on 03 Dec 2010, 10:15 AM
Hi Timothy,

You may try to subscribe to the Checked or Click events of the CheckBox define in your custom column - "cb" in your case and handle them in the definition of the CustomColumn class.  

Kind regards,
Maya
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Timothy
Top achievements
Rank 1
answered on 03 Dec 2010, 04:29 PM
But the Routine I need to run when clicked is in my main UI Class. Is there anything I can do in this case? And it doesnt run correctly when referenced from the column class.


Thanks,
Tim
0
Maya
Telerik team
answered on 06 Dec 2010, 10:13 AM
Hello Timothy,

Did the solution in this forum thread solved your issue or you need any further assistance on the topic ? 

Regards,
Maya
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Timothy
Top achievements
Rank 1
answered on 09 Dec 2010, 01:23 AM
Yes, it resolved my problem.

Thanks!

Tim
Tags
GridView
Asked by
Timothy
Top achievements
Rank 1
Answers by
Timothy
Top achievements
Rank 1
Maya
Telerik team
Share this question
or