
8 Answers, 1 is accepted
Currently we do not expose any property on the column that can be used. My suggestion is to use CellTemplate property of the column and define your own HyperlinkButton there. This button will have its command correctly bound to your view model.
Greetings,
Stefan Dobrev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.


<
my:GridViewDataColumn IsGroupable="True" IsFilterable="True" IsReadOnly="True" Header="Reference No." DataMemberBinding="{Binding Path=ReferenceNo}">
<my:GridViewDataColumn.CellStyle>
<Style TargetType="telerik:GridViewCell">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="telerik:GridViewCell">
<Border >
<HyperlinkButton x:Name="hlbReferenceNo" Grid.Column="0" Grid.Row="0" HorizontalContentAlignment="Center"
VerticalContentAlignment="Center" Tag="{Binding Path=CaseID}" Content="{Binding Path=ReferenceNo}" NavigateUri="" Click="hlbReferenceNo_Click" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</my:GridViewDataColumn.CellStyle>
</my:GridViewDataColumn>

I have same problem as you had.
I want to implement hyperlink into my GridViewHyperlink DataTemplate and bind it to run time in my custome GridView, for that I did this.
<
telerikcontrols:GridViewHyperlinkColumn
x:Name
=
"GridViewHyperLinkColumnTemplet"
>
<
telerikcontrols:GridViewColumn.CellTemplate
>
<
DataTemplate
>
<
HyperlinkButton
x:Name
=
"HyperLink"
Click
=
"HyperLink_Click"
HorizontalContentAlignment
=
"Center"
VerticalContentAlignment
=
"Center"
/>
</
DataTemplate
>
</
telerikcontrols:GridViewColumn.CellTemplate
>
</
telerikcontrols:GridViewHyperlinkColumn
>
------------------------------------------------------------------------------------------------------------------------------------
private void gvCalls_AutoGeneratingColumn(object sender, GridViewAutoGeneratingColumnEventArgs e)
{
if (e.Column.UniqueName == "xyz")
{
GridViewHyperLinkColumnTemplet = new Telerik.Windows.Controls.GridViewHyperlinkColumn();
//GridViewHyperLinkColumnTemplet.ContentBinding = (e.Column as Telerik.Windows.Controls.GridView).ContentBinding;
//GridViewHyperLinkColumnTemplet.DataMemberBinding = (e.Column as Telerik.Windows.Controls.GridViewBoundColumnBase).DataMemberBinding;
//GridViewHyperLinkColumnTemplet.DataMemberBinding = new System.Windows.Data.Binding() { Path = new PropertyPath(hrplbtn) }; //here hrplbtn is HyperlinkButton
//GridViewHyperLinkColumnTemplet.ContentBinding = new System.Windows.Data.Binding() { Path = new PropertyPath(hrplbtn)}; //here hrplbtn is HyperlinkButton
GridViewHyperLinkColumnTemplet.Header = e.Column.Header;
GridViewHyperLinkColumnTemplet.UniqueName = "xyz"; GridViewHyperLinkColumnTemplet.DisplayIndex = gvCalls.Columns.Count;
e.Column = GridViewHyperLinkColumnTemplet;
}
else
{
e.Cancel = true;
}
}
-----------------------------------------------------------------------------------------------------
private void HyperLink_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show(); or Open here particular child page with some calculation when user click
}
Now when I click on hyperlink it does not work or any exception.
Anybody have any idea how to do this. When user click on hyperlink or hyperlink button, open a child page into Silverlight application.
It is appreciate to resolved my problem.
Thanks,
Gaurang

Hi Stefan Dobrev
I did try command but it is not working. Can you provide a sample?
I am using RadControls for Silverlight Q1 2012 SP1- 2012.1.326.1050.
Here is xaml taken from the code
<telerik:GridViewDataColumn Header="Title"
Width="auto"
DataMemberBinding="{Binding Title}">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<HyperlinkButton Content="{Binding Title}"
Command="{Binding GetDetails,Mode=TwoWay}"
CommandParameter="{Binding ID,Mode=TwoWay}" />
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>


could you share how you solved it?
Thank you very much,
Mario

<!-- App.xaml -->
<
Application.Resources
>
<
Style
x:Key
=
"HyperlinkLikeButton"
TargetType
=
"Button"
>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"Button"
>
<
ContentPresenter
/>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
<
Setter
Property
=
"Foreground"
Value
=
"{DynamicResource {x:Static SystemColors.HotTrackBrushKey}}"
/>
<
Setter
Property
=
"Cursor"
Value
=
"Hand"
/>
<
Style.Triggers
>
<
Trigger
Property
=
"IsMouseOver"
Value
=
"true"
>
<
Setter
Property
=
"Foreground"
Value
=
"{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"
/>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"Button"
>
<
ControlTemplate.Resources
>
<
Style
TargetType
=
"{x:Type TextBlock}"
>
<
Setter
Property
=
"TextDecorations"
Value
=
"Underline"
/>
</
Style
>
</
ControlTemplate.Resources
>
<
ContentPresenter
/>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Trigger
>
</
Style.Triggers
>
</
Style
>
</
Application.Resources
>
<!-- MainWindow.xaml -->
...
<
DataGrid
Name
=
"dataGrid1"
AutoGenerateColumns
=
"False"
ItemsSource
=
"{Binding BazaBip.Companies.Items}"
HorizontalGridLinesBrush
=
"Silver"
VerticalGridLinesBrush
=
"Silver"
>
<
DataGrid.Columns
>
<
DataGridTextColumn
Width
=
"40"
Header
=
"ID"
Binding
=
"{Binding id}"
/>
<
DataGridHyperlinkColumn
Width
=
"100"
Header
=
"Www"
Binding
=
"{Binding www}"
>
<
DataGridHyperlinkColumn.CellStyle
>
<
Style
TargetType
=
"DataGridCell"
>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
>
<
Button
Style
=
"{StaticResource HyperlinkLikeButton}"
Content
=
"{Binding www}"
Command
=
"{Binding www.Click}" Margin="3,0"
/>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
DataGridHyperlinkColumn.CellStyle
>
</
DataGridHyperlinkColumn
>
</
DataGrid.Columns
>
</
DataGrid
>
...
<!-- Www.cs -->
{
public Www(string uri)
{
_uri = uri;
}
private string _uri;
public override string ToString()
{
return _uri;
}
private RelayCommand _click;
public RelayCommand Click
{
get
{
if (_click == null)
{
_click = new RelayCommand(() =>
{
Process.Start(_uri);
});
}
return _click;
}
}
}
<!-- CompanyViewModel.cs -->
....
{
get
{
if (String.IsNullOrWhiteSpace(dataEntity.www))
{
return null;
}
else
{
return new Www((!dataEntity.www.Contains("http://") ? "http://" : "") + dataEntity.www);
}
}
}
....