Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
325
Hyperlink In Xamdatagrid
posted

Hi,

I have used hyperlink and checkbox in Xamdatagrid .Am getting compliation error .

Am not able to resolve this error.I have attached a sample program with this for your reference.

Error

'eventSetter' is a type and cannot be used as an expression

 OnValueChanged' is not a member of 'WpfApplication1.Window1'

 

I guess this problem is because of  Cellvaluepresenter because if i comment that style used for hyperlink

error was not coming.

 

Kindly  provide a solution to resolve this above mentioned errors.

 

 

 

 

  • 69686
    posted

    Hello,

    When running your sample, I do not see a OnValueChanged event. First, make sure that you have successfully defined this event handler, so that you can link it with the EventSetter's Event to the ValueChanged handler.

    For example:

     

    <Style TargetType="{x:Type MyEditor:XamCheckEditor}">

                                                    <EventSetter Event="ValueChanged" Handler="XamCheckEditor_ValueChanged"/>

                                               </Style>

    in code behind:

     

    Private Sub XamCheckEditor_ValueChanged(ByVal sender As System.Object, ByVal e As System.Windows.RoutedPropertyChangedEventArgs(Of System.Object))

            MessageBox.Show("test")

        End Sub

    I am not sure why, but with the provided sample the Visual Studio compiler is throwing errors in the generated g.vb file. Strangely the generated code syntax is something between Visual Basic and C#. If you are experiencing the same, modify the g.vb file with the bolded line:

     

    If (connectionId = 4) Then

                Dim eventSetter As New System.Windows.EventSetter

                eventSetter.Event = Infragistics.Windows.Editors.ValueEditor.ValueChangedEvent

                #ExternalSource("..\..\Window1.xaml",42)

                eventSetter.Handler = New System.Windows.RoutedPropertyChangedEventHandler(Of Object)(AddressOf Me.XamCheckEditor_ValueChanged)

                #End ExternalSource

                CType(target,System.Windows.Style).Setters.Add(eventSetter)

            End If