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

[Solved] dynamically created a grid view

2 Answers 76 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Vivek
Top achievements
Rank 1
Vivek asked on 29 Jun 2011, 08:29 AM

Hi Telerik team,

 

I have dynamically created a grid view and it has three columns one is id layer, color and state and now I want to set the color according to the cell, I have hex value of the color like #FFFFF now I need to change this to the color.

 

How we can set it the color of the cell?

 

Please guide me in right direction with some code examples.

 

Thanks,

Vivek.

2 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 29 Jun 2011, 08:34 AM
Hi Vivek,

 

If you want to apply some condtional formatting based on the underlying property values you should use StyleSelectors. Please refer to our online demos for further info, follow this link.
 

Kind regards,
Vanya Pavlova
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
0
Vivek
Top achievements
Rank 1
answered on 29 Jun 2011, 08:49 AM
Hi Vanya Pavlova,

I have created all cells dynamically and I have three columns which we have created dynamically I have color value in hex and now I need to change this hex value into color, can we do something like this.

Please see the screen shot as well as code.
<telerik:RadGridView x:Name="RadGridView1" CanUserSelect="True"   IsReadOnly="True" ShowGroupPanel="False"  Width="300"   CanUserResizeColumns="False" CanUserFreezeColumns="False"  CanUserSortColumns="True" GridLinesVisibility="None"  SelectionMode="Multiple" RowIndicatorVisibility="Collapsed" Grid.Row="1"
                               </telerik:RadGridView>

public void AddLayer()
        {
            listLayersName.Clear();
 
            for (int i = 0; i < viewport.DisplayedPage.Layers.Count; i++)
            {
                 
                listLayersName.Add(viewport.DisplayedPage.Layers[i].Name.ToString());
 
 
                layerList.Add(new LayerData(viewport.DisplayedPage.Layers[i].Name.ToString(), viewport.DisplayedPage.Layers[i].Color.ToString(), "On"));
                 
            }
            RadGridView1.ItemsSource = layerList;
 
            RadGridView1.RowActivated += new EventHandler<RowEventArgs>(RadGridView1_RowActivated);
            RadGridView1.Sorted += new EventHandler<GridViewSortedEventArgs>(RadGridView1_Sorted);
             
             
 
        }


Thanks,
Vivek
Tags
GridView
Asked by
Vivek
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Vivek
Top achievements
Rank 1
Share this question
or