Dynamically Setting Background Colour of RadTileViewItem Header

5 posts, 1 answers
  1. Naren
    Naren avatar
    53 posts
    Member since:
    Aug 2010

    Posted 18 Nov 2010 Link to this post

    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
  2. Answer
    Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1512 posts

    Posted 18 Nov 2010 Link to this post

    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
  3. DevCraft banner
  4. Naren
    Naren avatar
    53 posts
    Member since:
    Aug 2010

    Posted 19 Nov 2010 Link to this post

    Thank you that was helpful......
  5. GM72
    GM72 avatar
    23 posts
    Member since:
    Sep 2012

    Posted 12 Jan 2011 Link to this post

    The solution to set the colour of the header doesn't work as item.ChildrenOfType<Border>() is always = 0 when I try this?
  6. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 14 Jan 2011 Link to this post

    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>>
Back to Top
DevCraft banner