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

Dynamically Setting Background Colour of RadTileViewItem Header

4 Answers 149 Views
TileView
This is a migrated thread and some comments may be shown as answers.
Naren
Top achievements
Rank 1
Naren asked on 18 Nov 2010, 09:26 AM
Hi Miro Miroslavov ,
you replyed me in the post with following link
http://www.telerik.com/community/forums/silverlight/tileview/dynamically-setting-background-colour-to-radtileviewitem-header.aspx#1423338

The solution you provided show customization for static tile view(Tile view declared in Xaml).
I want customization for tile view created at runtime in code........

I am creating RadTileView at runtime as follows

public MainPage()
        {
            // Required to initialize variables
            InitializeComponent()
           
RadTileView myTView = new RadTileView();

           RadTileViewItem myTileViewItem = new RadTileViewItem();
            myTileViewItem.Header = "My Header";
myTView.Items.Add(myTileViewItem);

        }
How can i set header background color of myTileViewItem to Green in code .

can you  provide solution for above...
Thanks in advance

4 Answers, 1 is accepted

Sort by
0
Accepted
Kiril Stanoev
Telerik team
answered on 18 Nov 2010, 03:11 PM
Hi Naren,

The solution Miroslav has provided will work even if you define the items dyncamically. Please have a look at the attached project (tileviewheader.zip).

However, if you want to set custom color to each tile item separately, you need to take a look at the second attached project (tileviewcustomcolor.zip).

All the best,
Kiril Stanoev
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Naren
Top achievements
Rank 1
answered on 19 Nov 2010, 11:03 AM
Thank you that was helpful......
0
GM72
Top achievements
Rank 1
answered on 12 Jan 2011, 06:52 PM
The solution to set the colour of the header doesn't work as item.ChildrenOfType<Border>() is always = 0 when I try this?
0
Petar Mladenov
Telerik team
answered on 14 Jan 2011, 03:48 PM
Hello Naren,

Are you sure you haven`t missed the dispatcher from the sample? It is mandatory in this case, since it ensures that the visual containers have been generated.

All the best,
Petar Mladenov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
TileView
Asked by
Naren
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Naren
Top achievements
Rank 1
GM72
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or