<telerik:RadGridView ItemsSource="{Binding ListClass1, Mode=TwoWay}" AutoGenerateColumns="False"> <telerik:RadGridView.Columns> <telerik:GridViewDataColumn Width="100" DataMemberbinding="{Binding Grid1}" Header="SÃmbolo" IsFilterable="False" /> <telerik:GridViewDataColumn Width="*" DataMemberBinding="{Binding String1}" Header="Valor" IsFilterable="False" /> </telerik:RadGridView.Columns></telerik:RadGridView>Do I need to change the CellTemplate?
Thanks.
5 Answers, 1 is accepted
Basically, if you want to define a specific element inside the cell, you need to set either CellTemplate or CellEditTemplate, depending on your requirements. However, the code-snippet you post does not provide me with enough information about your goal. So, please share more details on the topic in order for me to be able to suggest any further.
Maya
the Telerik team
private ObservableCollection<Category> listCategory;public ObservableCollection<Category> ListCategory;{ get { return listCategory; }}//...public class Category{ public Category() { firstCell = new Grid(); firstCell.Children.Add(new Rectangle() { Width = 8, Height = 17, Fill = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0)) }); secondCell = "string test"; } private Grid firstCell; private string secondCell; public Grid FirstCell { get { return firstCell; } set { firstCell = value; } } public string SecondCell { get { return secondCell; } set { secondCell = value; } }}And that's the XAML:
<telerik:RadGridView ItemsSource="{Binding ListCategory}" AutoGenerateColumns="False"> <telerik:RadGridView.Columns> <telerik:GridViewDataColumn Width="100" DataMemberbinding="{Binding FirstCell}" Header="Column 1" IsFilterable="False" /> <telerik:GridViewDataColumn Width="*" DataMemberBinding="{Binding SecondCell}" Header="Column 2" IsFilterable="False" /> </telerik:RadGridView.Columns></telerik:RadGridView>What do I need to do to achieve this?
You may define your Templates in the xaml file and then define them inside the CellTemplate of a particular column. Let me know if you need any further assistance.
Maya
the Telerik team
I am not quite sure about the purpose of your attempt to change cell dynamically. What is the exact behavior you want to achieve ? As mentioned previously, you may work with the CellTemplate of a particular column and define the element you want to display inside.
Maya
the Telerik team