RadJumpList Selected Item Background

7 posts, 0 answers
  1. Randhir
    Randhir avatar
    15 posts
    Member since:
    Jul 2010

    Posted 17 Jun 2011 Link to this post

    Hi,

    I have been using Telerik Controls for windows phone 7. By default selected item for RadJumpList has blue foreground color: Can i have selected item background color changed.

    Plesae help,
    thank's

  2. Viperal
    Viperal avatar
    2 posts
    Member since:
    Jul 2012

    Posted 17 Jun 2011 Link to this post

    I noticed this in the Q2 2011 beta (not sure about the Q1 release)

    I was able to get around it by setting the Foreground color.   I'm thinking that it should really be up to the developer to add the color change and not have it done by default.

    The below will add the themes default color and stop the color change.  (Works in the Q2 2011 Beta)

    Foreground="{StaticResource PhoneForegroundBrush}"
  3. DevCraft banner
  4. Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 20 Jun 2011 Link to this post

    Hi Ryan and Randhir,

    By default, both RadDataBoundListBox and RadJumpList use the Accent color of the phone (the currently selected theme color) to define the foreground of the selected item. This is by design and could easily be changed by changing the template of the visual item or by simply setting a new foreground color upon the SelectionChanged event.

    Let me know if you have further questions or need assistance.

    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>>
  5. Randhir
    Randhir avatar
    15 posts
    Member since:
    Jul 2010

    Posted 23 Jun 2011 Link to this post

    Hi Deyan,

    Thanks for the reply. Could please explain the steps in expression blend to change the selectedstate style.
    I have already worked with visual states and changed the selected state template in expression blend 4 for list. When i open this RadJumplist control in expression blend i do not get any option.

    Thank's
    Randhir
  6. Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 24 Jun 2011 Link to this post

    Hi Randhir,

    We have made some investigations and it seems that we still need to extend the design-time support of RadDataBoundListBox/RadJumpList to allow for editing ItemContainerStyles in Expression Blend. With the current version of the controls this is not possible. We have logged this in our TODO system and will provide the possibility for the Q2 2011 release of RadControls for Windows Phone 7 (scheduled for mid July).

    For now, you can use the style I am pasting here and edit it according to your requirements. You can use the ItemContainerStyle property of RadJumpList to override the default style of the visual containers.

    <Style TargetType="telerikPrimitives:RadDataBoundListBoxItem">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="CacheMode" Value="BitmapCache"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="telerikPrimitives:RadDataBoundListBoxItem">
                    <Border x:Name="LayoutRoot" Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TransparentBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation Storyboard.TargetName="ContentContainer" Storyboard.TargetProperty="Opacity" Duration="0" To=".5" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Unselected"/>
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentContainer" Storyboard.TargetProperty="Foreground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ContentControl x:Name="ContentContainer"
                                          HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalAlignment}"
                                          HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                          Margin="{TemplateBinding Padding}"
                                          Content="{TemplateBinding Content}"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    I hope this helps.

    Do not hesitate to get back to us in case you have further questions or need assistance.

    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>>
  7. Randhir
    Randhir avatar
    15 posts
    Member since:
    Jul 2010

    Posted 03 Jul 2011 Link to this post

    Hi Deyan,

    I was able to change the foreground color but i was not able to change the background color of the selected item.

    Please help,
    Thank's
    Randhir
  8. Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 04 Jul 2011 Link to this post

    Hello Randhir,

    Could you please prepare a sample project that demonstrates your approach and send it to us so that we can directly take a look at it and see how we can help you further. Please note that you will have to open a new support ticket in order to be able to attach your project.

    Thanks for your time.

    Regards,
    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
DevCraft banner