Set background color for selected item

4 posts, 0 answers
  1. IDispose
    IDispose avatar
    12 posts
    Member since:
    Apr 2010

    Posted 02 May 2011 Link to this post

    Following the instructions in the help document, I am unable to set the background color for the selected item Here is the setting I am using,

    <VisualState x:Name="Selected">
        <Storyboard>
            <DoubleAnimation Storyboard.TargetName="contentPresenter" 
    	Storyboard.TargetProperty="Opacity" 
            To="1" 
            Duration="0"/>
            <DoubleAnimation Duration="0" To="24" 
            Storyboard.TargetProperty="(Control.FontSize)" 
            Storyboard.TargetName="contentPresenter" 
            d:IsOptimized="True"/>
            <DoubleAnimation Duration="0" 
            To="Pink" 
            Storyboard.TargetProperty="(Control.Background).(SolidColorBrush.Color)" 
            Storyboard.TargetName="contentPresenter" 
            d:IsOptimized="True"/>
            </Storyboard>
    </VisualState>

    Please advise

    thanks
    ramesh
  2. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 04 May 2011 Link to this post

    Hello Ramesh,

    Thanks for writing.

    Please try using a ObjectAnimationUsingKeyFrames to set the color:

    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="contentPresenter">
        <DiscreteObjectKeyFrame KeyTime="0" Value="Pink"/>
    </ObjectAnimationUsingKeyFrames>

    You cannot animate colors by using a DoubleAnimation since the color is not a double value.

    I hope this helps.

    Best wishes,
    Deyan
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. DevCraft banner
  4. IDispose
    IDispose avatar
    12 posts
    Member since:
    Apr 2010

    Posted 04 May 2011 Link to this post

    Deyan
    Thank you for the response and alerting me to why DoubleAnimation does not work.

    Unfortunately, the suggested solution does not work, The background color is not being set.

    Anything else to try?
  5. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 05 May 2011 Link to this post

    Hi Ramesh,

    Thanks for getting back to me and for the provided feedback.

    In this case, I would like to kindly ask you to prepare a sample application that we can use to reproduce the case and see how we can help.

    You can upload the requested application in the support ticket you have opened regarding the same topic.

    Thanks for your time.

    Best wishes,
    Deyan
    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