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

Sort Columns

1 Answer 60 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Fabiana
Top achievements
Rank 1
Fabiana asked on 07 Jul 2010, 04:47 PM
Hello support!
I need use CellTemplate in my grid...I can´t set Tag in GridViewHyperlinkColumn, for example...
Can I sort grid columns using CellTemplate?? I can´t... Why?

Can I use

 

DataMemberBinding with CellTemplate to resolve it??

Thanks!!

 

 



 

 

<

 

 

UserControl x:Class="Sample.SilverlightControl1"

 

 

 

 

 

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

 

 

 

 

 

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

 

 

 

 

 

xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

 

 

 

 

 

xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

 

 

 

 

 

xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"

 

 

 

 

 

xmlns:my="clr-namespace:Sample"

 

 

 

 

 

mc:Ignorable="d" d:DesignHeight="400" d:DesignWidth="600">

 

 

 

 

 

 

 

<UserControl.Resources>

 

 

 

 

 

 

    <my:MyViewModel x:Key="MyViewModel"/>

 

 

 

 

 

 

 

    <DataTemplate x:Key="NameTemplate" >

 

 

 

 

 

 

        <HyperlinkButton Tag="1" Content="{Binding Name}" IsTabStop="False" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,3,0,3" />

 

 

 

 

 

 

    </DataTemplate>


 

 

 

 

 

 

 

 

</UserControl.Resources>

 

 

 

 

 

 

 

<Grid x:Name="LayoutRoot" Background="White" DataContext="{StaticResource MyViewModel}">

 

 

 

 

 

 

    <Grid.RowDefinitions>

 

 

 

 

 

 

    <RowDefinition Height="*"/>

 

 

 

 

 

 

    <RowDefinition Height="Auto" />

 

 

 

 

 

 

    <RowDefinition Height="Auto" />

 

 

 

 

 

 

</Grid.RowDefinitions>

 

 

 

 

 

 

 

 

 

    <telerik:RadGridView Grid.Row="0" x:Name="PlayersGrid" AutoGenerateColumns="False" Margin="5" ShowGroupPanel="False" SelectionUnit="Cell" RowIndicatorVisibility="Collapsed">

 

 

 

 

 

 

        <telerik:RadGridView.Columns>

 

 

 

 

 

 

 

            <telerik:GridViewDataColumn x:Name="RadColumnName" Width = "*" Header="Name" CellTemplate="{StaticResource NameTemplate}" />

 

 

 

 

 

 

        </telerik:RadGridView.Columns>

 

 

 

 

 

 

    </telerik:RadGridView>

 

 

 

 

 

 

 

<telerik:RadDataPager x:Name="radDataPager" Grid.Row="1" Source="{Binding Items, ElementName=PlayersGrid}" PageSize="2" DisplayMode="All" />

 

 

 

 

 

 

</Grid>

 

 

 

</

 

 

UserControl>

 

 

 

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 08 Jul 2010, 07:46 AM
Hi,

 I'm not sure how CellTemplate is related to sorting - can you clarify? Generally sorting can be accomplished only at data-source level - you cannot sort by something visually displayed by some template. To enable sorting for some grid column you can use DataMemberBinding and/or SortMemberPath properties - you can still define any custom template and with desired content. 

Greetings,
Vlad
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
Tags
GridView
Asked by
Fabiana
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or