Sort a Custom Column

2 posts, 1 answers
  1. StevenDale
    StevenDale avatar
    100 posts
    Member since:
    Apr 2007

    Posted 22 Aug 2010 Link to this post

    I have a the following column definition:  I want to be able to sort this column on the Sailor.Name property. How do I accomplish this?

    Thanks in advance,

    <telerik:GridViewColumn Width="*" Header="Sailor" IsSortable="True" >
      <telerik:GridViewColumn.CellTemplate>
        <DataTemplate>
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*" />
              <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock Text="{Binding Name}" />
            <Image Source="{DynamicResource User_Man_Padlock}" Grid.Column="1" Margin="0,0,10,0" ToolTip="{Binding DetailRequisitionAssignedTo, Converter={StaticResource DetailRequisitionConverter}}" Height="15"  >
              <Image.Visibility>
                <MultiBinding Converter="{StaticResource SailorLockVisibilityConverter}" ConverterParameter="Left">
                  <Binding Path="DetailRequisitionAssignedTo" />
                  <Binding RelativeSource="{RelativeSource AncestorType={x:Type local:MainWindow}}" Path="DataContext.SailorsOnLeft" />
                  <Binding RelativeSource="{RelativeSource AncestorType={x:Type local:MainWindow}}" Path="DataContext.SelectedJobInformation" />
                </MultiBinding>
              </Image.Visibility>
            </Image>
            <Image Source="{DynamicResource Padlock}" Grid.Column="1" Margin="0,0,10,0" ToolTip="{Binding DetailRequisitionAssignedTo, Converter={StaticResource DetailRequisitionConverter}}" Height="15"  >
              <Image.Visibility>
                <MultiBinding Converter="{StaticResource SailorLockVisibilityConverter}" ConverterParameter="Right">
                  <Binding Path="DetailRequisitionAssignedTo" />
                  <Binding RelativeSource="{RelativeSource AncestorType={x:Type local:MainWindow}}" Path="DataContext.SailorsOnLeft" />
                  <Binding RelativeSource="{RelativeSource AncestorType={x:Type local:MainWindow}}" Path="DataContext.SelectedJobInformation" />
                </MultiBinding>
              </Image.Visibility>
            </Image>
            <Image Source="{DynamicResource User_Man_Padlock}" Grid.Column="1" Margin="0,0,10,0" ToolTip="{Binding DetailRequisitionAssignedTo, Converter={StaticResource DetailRequisitionConverter}}" Height="15"  >
              <Image.Visibility>
                <MultiBinding Converter="{StaticResource SailorLockVisibilityConverter}" ConverterParameter="AssignedTo">
                  <Binding Path="DetailRequisitionAssignedTo" />
                  <Binding RelativeSource="{RelativeSource AncestorType={x:Type local:MainWindow}}" Path="DataContext.SailorsOnLeft" />
                  <Binding RelativeSource="{RelativeSource AncestorType={x:Type local:MainWindow}}" Path="DataContext.SelectedJobInformation" />
                </MultiBinding>
              </Image.Visibility>
            </Image>
          </Grid>
        </DataTemplate>
      </telerik:GridViewColumn.CellTemplate>
    </telerik:GridViewColumn>

    Billy Jacobs
  2. Answer
    Milan
    Admin
    Milan avatar
    1989 posts

    Posted 23 Aug 2010 Link to this post

    Hi Billy Jacobs,

    You just have to use GridViewDataColumn instead of GridViewColumn and set DataMemberBinding on the column ("Sailor.Name").


    Sincerely yours,
    Milan
    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
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top