This question is locked. New answers and comments are not allowed.
I'm just starting on using the Silverlight RadGridView, and have come across a puzzle. Our standard of behavior in the Ajax RadGrid is to allow the rows of the grid to be "click to select" for the purposes of functions in the grid (delete, copy, etc.), but to have the text or image of each cell be a LinkButton or ImageButton that will open a new web page allowing the edit of the item shown in the grid. I need to mimic this functionality in the radgridview as closely as possible. Here's the way I'm currently doing that:
The major problem I have is that I've got about 30 more text columns to make, and I would like to find a way to make the DataTemplate a static resource that takes its content from whatever the column would have displayed by default. Is there any way to do this? I'll mess with the default style, or even the theme if I have to to make this work right.
--Christina
P.S. I looked at Hyperlink columns, but as far as I can tell they assume you're navigating directly to a URL, which doesn't work right for this since we need to save state and do some setup in the "Hyperlink_Click" function before we can actually go. If the Hyperlink columns CAN actually go to a function instead of direct to the URL, that's definitely an acceptable solution and I'd appreciate pointers on how to make it work.
<telerik:RadGridView x:Name="grdFiles" SelectionMode="Extended" telerik:StyleManager.Theme="Office_Blue" AutoGenerateColumns="false" ItemsSource="{Binding Source={StaticResource FolderSource}, Path=Files}" RowLoaded="grdFiles_RowLoaded" SelectionChanging="grdFiles_SelectionChanging" RowIndicatorVisibility="Collapsed" FrozenColumnCount="3" CanUserFreezeColumns="false" > <telerik:RadGridView.Columns> <telerik:GridViewSelectColumn UniqueName="SelectColumn" /> <telerik:GridViewDataColumn DataMemberBinding="{Binding FileVersionOID}" Header="ID" IsReadOnly="True" /> <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Name" IsReadOnly="True" MaxWidth="250"> <telerik:GridViewColumn.CellTemplate> <DataTemplate> <HyperlinkButton ClickMode="Press" Foreground="Black" Click="HyperlinkButton_Click" Content="{Binding Name}" CommandParameter="{Binding}" HorizontalAlignment="Left" /> </DataTemplate> </telerik:GridViewColumn.CellTemplate> </telerik:GridViewDataColumn> <telerik:GridViewDataColumn DataMemberBinding="{Binding IsFavorite}" Header="Favorite" IsReadOnly="True" > <telerik:GridViewDataColumn.CellTemplate> <DataTemplate> <HyperlinkButton Click="HyperlinkButton_Click" CommandParameter="{Binding}" Visibility="{Binding IsFavorite, Converter={StaticResource VisibilityConverter}}" HorizontalContentAlignment="Center" > <Image Source="images/Favorite_Small.png" /> </HyperlinkButton> </DataTemplate> </telerik:GridViewDataColumn.CellTemplate> </telerik:GridViewDataColumn> <telerik:GridViewDataColumn DataMemberBinding="{Binding Description}" Header="Description" IsReadOnly="true" TextWrapping="Wrap" MaxWidth="250" > <telerik:GridViewColumn.CellTemplate> <DataTemplate> <HyperlinkButton ClickMode="Press" Foreground="Black" Click="HyperlinkButton_Click" Content="{Binding Description}" CommandParameter="{Binding}" HorizontalAlignment="Left"/> </DataTemplate> </telerik:GridViewColumn.CellTemplate> </telerik:GridViewDataColumn> </telerik:RadGridView.Columns> </telerik:RadGridView>The major problem I have is that I've got about 30 more text columns to make, and I would like to find a way to make the DataTemplate a static resource that takes its content from whatever the column would have displayed by default. Is there any way to do this? I'll mess with the default style, or even the theme if I have to to make this work right.
--Christina
P.S. I looked at Hyperlink columns, but as far as I can tell they assume you're navigating directly to a URL, which doesn't work right for this since we need to save state and do some setup in the "Hyperlink_Click" function before we can actually go. If the Hyperlink columns CAN actually go to a function instead of direct to the URL, that's definitely an acceptable solution and I'd appreciate pointers on how to make it work.