datagrid V1: hyperlinks clicks

Nov 7, 2008 at 3:01 PM
Hi

I like to use a hyperlink column (for non uri content) and I want to define what happens on the click of the link.

How can I achieve this?

Regards
klaus
Coordinator
Nov 7, 2008 at 3:31 PM
Edited Nov 7, 2008 at 3:31 PM
See this thread, http://www.codeplex.com/wpf/Thread/View.aspx?ThreadId=37127.
Nov 7, 2008 at 3:39 PM
Hi

seems that I am not the only one ;-)

But: it does not compile on my system either, I get an other error during build:
Error    3    'eventSetter' is a type and cannot be used as an expression.    D:\Blending\01_Software\01_Master\6100\Source\Infor.Blending.Admin\Infor.Blending.Admin.Client\obj\Debug\UserControls\Modules.g.vb    227    Infor.Blending.Admin.Client
Regards
Klaus

Coordinator
Nov 10, 2008 at 4:48 PM
Can you show a code snippet of the place where you are getting this error.
Nov 10, 2008 at 8:45 PM
Hi

I just copied the xaml from the thread you mentioned:

<dg:DataGridHyperlinkColumn Header="Homepage" CanUserSort="False" Binding="{Binding Path=ModuleName}">
    <dg:DataGridHyperlinkColumn.ElementStyle>
        <Style TargetType="TextBlock">
            <EventSetter Event="Hyperlink.Click" Handler="dgData_DetailsButton_Click" />
        </Style>
    </dg:DataGridHyperlinkColumn.ElementStyle>
</dg:DataGridHyperlinkColumn>

During compile time, I get the error

Regards
Klaus


Coordinator
Nov 11, 2008 at 4:10 PM
I followed the code at the beginning of the thread, http://www.codeplex.com/wpf/Thread/View.aspx?ThreadId=37127, and didn't have any issues.  What does your dgData_DetailsButton_Click look like?
Nov 11, 2008 at 4:36 PM

Vincent

I just tried to separate the problem in a demo project, and there I do not have a problem.

When I try to use the same xaml and handler in my bigger development project I get the build error below.

The Xaml is
dg:DataGridHyperlinkColumn Header="Homepage" CanUserSort="False" Binding="{Binding Path=ModuleName}">
dg:DataGridHyperlinkColumn.ElementStyle>
Style TargetType="TextBlock">
EventSetter Event="Hyperlink.Click" Handler="dgData_DetailsButton_Click" />
Style>
dg:DataGridHyperlinkColumn.ElementStyle>
dg:DataGridHyperlinkColumn>

The line 130 of modules.xaml is EventSetter Event="Hyperlink.Click" Handler="dgData_DetailsButton_Click" />,

The handler is

Private Sub dgData_DetailsButton_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
MsgBox("hi")
End Sub

I get the following errors, if I comment the xaml snippet all is fine.
Maybe my solution is kind of messed up? I already cleaned but no help

Thanks for your support
Klaus

Error 1 Reference to a non-shared member requires an object reference. D:\Blending\01_Software\01_Master\6100\UserControls\Modules.xaml 130 Infor.Blending.Admin.Client

Error 2 'eventSetter' is a type and cannot be used as an expression. D:\Blending\01_Software\01_Master\6100\Source\Infor.Blending.Admin\Infor.Blending.Admin.Client\obj\Debug\UserControls\Modules.g.vb 227 Infor.Blending.Admin.Client

Error 3 Reference to a non-shared member requires an object reference. D:\Blending\01_Software\01_Master\6100\Source\Infor.Blending.Admin\Infor.Blending.Admin.Client\obj\Debug\UserControls\Modules.g.vb 228 Infor.Blending.Admin.Client

Error 4 'eventSetter' is a type and cannot be used as an expression. D:\Blending\01_Software\01_Master\6100\Source\Infor.Blending.Admin\Infor.Blending.Admin.Client\obj\Debug\UserControls\Modules.g.vb 234 Infor.Blending.Admin.Client

Error 5 The tag 'NotBooleanToVisibilityConverter' does not exist in XML namespace 'clr-namespace:Infor.Blending.Admin.Client'. Line 14 Position 4. D:\Blending\01_Software\01_Master\6100\Source\Infor.Blending.Admin\Infor.Blending.Admin.Client\Application.xaml 14 4 Infor.Blending.Admin.Client

Error 6 Unknown build error, 'Could not load file or assembly 'file:///D:\Blending\01_Software\01_Master\6100\Source\Infor.Blending.Admin\Infor.Blending.Admin.Client\obj\Debug\Infor.Blending.Admin.Client.exe' or one of its dependencies. The system cannot find the file specified. Line 13 Position 23.' D:\Blending\01_Software\01_Master\6100\Source\Infor.Blending.Admin\Infor.Blending.Admin.Client\UserControls\Modules.xaml 13 23 Infor.Blending.Admin.Client

Error 7 Unknown build error, 'Could not load file or assembly 'file:///D:\Blending\01_Software\01_Master\6100\Source\Infor.Blending.Admin\Infor.Blending.Admin.Client\obj\Debug\Infor.Blending.Admin.Client.exe' or one of its dependencies. The system cannot find the file specified. Line 13 Position 23.' D:\Blending\01_Software\01_Master\6100\Source\Infor.Blending.Admin\Infor.Blending.Admin.Client\UserControls\Packages.xaml 13 23 Infor.Blending.Admin.Client

Error 8 Unknown build error, 'Could not load file or assembly 'file:///D:\Blending\01_Software\01_Master\6100\Source\Infor.Blending.Admin\Infor.Blending.Admin.Client\obj\Debug\Infor.Blending.Admin.Client.exe' or one of its dependencies. The system cannot find the file specified. Line 17 Position 57.' D:\Blending\01_Software\01_Master\6100\Source\Infor.Blending.Admin\Infor.Blending.Admin.Client\ApplicationMainWindow.xaml 17 57 Infor.Blending.Admin.Client

Error 9 Unknown build error, 'Could not load file or assembly 'file:///D:\Blending\01_Software\01_Master\6100\Source\Infor.Blending.Admin\Infor.Blending.Admin.Client\obj\Debug\Infor.Blending.Admin.Client.exe' or one of its dependencies. The system cannot find the file specified. Line 11 Position 23.' D:\Blending\01_Software\01_Master\6100\Source\Infor.Blending.Admin\Infor.Blending.Admin.Client\UserControls\UserGroupModules.xaml 11 23 Infor.Blending.Admin.Client

Error 10 Unknown build error, 'Could not load file or assembly 'file:///D:\Blending\01_Software\01_Master\6100\Source\Infor.Blending.Admin\Infor.Blending.Admin.Client\obj\Debug\Infor.Blending.Admin.Client.exe' or one of its dependencies. The system cannot find the file specified. Line 12 Position 23.' D:\Blending\01_Software\01_Master\6100\Source\Infor.Blending.Admin\Infor.Blending.Admin.Client\UserControls\UserGroups.xaml 12 23 Infor.Blending.Admin.Client

Error 11 'EventSetter' is a type and cannot be used as an expression. D:\Blending\01_Software\01_Master\6100\Source\Infor.Blending.Admin\Infor.Blending.Admin.Client\obj\Debug\UserControls\Modules.g.i.vb 227 10 Infor.Blending.Admin.Client

Error 12 Reference to a non-shared member requires an object reference. D:\Blending\01_Software\01_Master\6100\Source\Infor.Blending.Admin\Infor.Blending.Admin.Client\obj\Debug\UserControls\Modules.g.i.vb 228 10 Infor.Blending.Admin.Client

Error 13 Reference to a non-shared member requires an object reference. D:\Blending\01_Software\01_Master\6100\Source\Infor.Blending.Admin\Infor.Blending.Admin.Client\obj\Debug\UserControls\Modules.g.i.vb 231 10 Infor.Blending.Admin.Client

Error 14 'EventSetter' is a type and cannot be used as an expression. D:\Blending\01_Software\01_Master\6100\Source\Infor.Blending.Admin\Infor.Blending.Admin.Client\obj\Debug\UserControls\Modules.g.i.vb 234 58 Infor.Blending.Admin.Client