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

RadGridView dynamic presentation

1 Answer 74 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 11 Apr 2011, 08:34 PM
I have a RadGridView that is using a GridViewDataColumn, CellTemplate, and some DataTemplates to display an appropriate editor based on the type of data in the current row. I also have a GridViewComboBoxColumn on the same row.
My first question is if it's possible to change the combobox to behave more like a "vanilla" WPF combobox - always displaying the selection arrow and requiring only a single click to edit the contents?
My second question is I how I cause the combobox to accept it's current value when the user clicks in the GridViewDataColumn. If it's a standard GridViewDataColumn the behavior is what I would expect (clicking in the cell will change the underlying data for the combobox) but if I use a CellTemplate to display a different editor that behavior is lost.

EDIT: The sort of behavior I'm trying to mimic is best described with the classes below. Imagine having an ObservableCollection<Player> that you wanted to display in a GridView. For Pitchers you want to show an editor for the RunAverage, for Batters you want to show BattingAverage, and for regular Players you want to show the Salary.
public class Player
{
   public string Name {get;set;}
   public int JersyNumber {get;set;}
   public Currency Salary {get;set;}
}

public class Pitcher : Player
{
   public decimal RunAverage {get;set;}
}
public class Batter : Player
{
   public decimal BattingAverage{get;set;}
}

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 12 Apr 2011, 07:04 AM
Hi,

 I believe that CellTemplateSelectors will work perfectly in your case. 

All the best,
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
Andrew
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or