How do I Bold the Text in ListBox Selected Item

2 posts, 0 answers
  1. Debasis
    Debasis avatar
    9 posts
    Member since:
    May 2011

    Posted 30 May 2011 Link to this post

    Hi,
    How do I Bold the Text in ListBox Selected Item? I want the Text should be Bold when user select a List Box item. Here is my XAML Style
    <Style x:Key="CallroutingLeftMenuItemStyle" TargetType="ListBoxItem">
      
    <Setter Property="Padding" Value="0 0 0 0"/>
      
    <!--<Setter Property="Margin" Value="0,0,0,0" />-->
      
    <Setter Property="HorizontalContentAlignment" Value="Left"/>
      
    <Setter Property="VerticalContentAlignment" Value="Top"/>
      
    <Setter Property="Background" Value="Transparent"/>
      
    <Setter Property="BorderThickness" Value="1"/>
      
    <Setter Property="TabNavigation" Value="Local"/>
      
    <Setter Property="Template">
      
    <Setter.Value>
      
    <ControlTemplate TargetType="ListBoxItem">
      
    <Grid Background="{TemplateBinding Background}">
      
    <VisualStateManager.VisualStateGroups>
      
    <VisualStateGroup x:Name="CommonStates">
      
    <VisualState x:Name="Normal"/>
      
    <VisualState x:Name="MouseOver">
      
    <Storyboard>
      
    <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="fillColor"/>
      
    </Storyboard>
      
    </VisualState>
      
    <VisualState x:Name="Disabled">
      
    <Storyboard>
      
    <DoubleAnimation Duration="0" To=".55" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="contentPresenter"/>
      
    </Storyboard>
      
    </VisualState>
      
    </VisualStateGroup>
      
    <VisualStateGroup x:Name="SelectionStates">
      
    <VisualState x:Name="Unselected"/>
      
    <VisualState x:Name="Selected">
      
    <Storyboard>
      
    <DoubleAnimation Duration="0" To=".70" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="fillColor2"/>
      
    </Storyboard>
      
    </VisualState>
      
    </VisualStateGroup>
      
    <VisualStateGroup x:Name="FocusStates">
      
    <VisualState x:Name="Focused">
      
    <Storyboard>
      
    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="FocusVisualElement">
      
    <DiscreteObjectKeyFrame KeyTime="0">
      
    <DiscreteObjectKeyFrame.Value>
      
    <Visibility>Visible</Visibility>
      
    </DiscreteObjectKeyFrame.Value>
      
    </DiscreteObjectKeyFrame>
      
    </ObjectAnimationUsingKeyFrames>
      
    </Storyboard>
      
    </VisualState>
      
    <VisualState x:Name="Unfocused"/>
      
    </VisualStateGroup>
      
    </VisualStateManager.VisualStateGroups>
      
    <!--<Rectangle x:Name="fillColor" Fill="#FFBADDE9" IsHitTestVisible="False" Opacity="0" RadiusY="1" RadiusX="1"/>-->
      
    <Rectangle x:Name="fillColor" Fill="#ecf5ff" Stroke="#0066cc" StrokeThickness="1" IsHitTestVisible="False" Opacity="0" RadiusY="1" RadiusX="1"/>
      
    <!--<Image x:Name="fillColor2" Margin="0,0,0,0" Source="../Assets/Images/Right.png" IsHitTestVisible="False" HorizontalAlignment="Left" Height="23" Width="193" Opacity="0"/>-->
      
    <Rectangle x:Name="fillColor2" Fill="#f5f5f5" IsHitTestVisible="False" Opacity="0" RadiusY="1" RadiusX="1"/>
      
    <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}"/>
      
    <Rectangle x:Name="FocusVisualElement" RadiusY="1" RadiusX="1" Stroke="Transparent" StrokeThickness="1" Visibility="Collapsed"/>
      
    </Grid>
      
    </ControlTemplate>
      
    </Setter.Value>
      
    </Setter>
      
    </Style>

    Thank in advance for your valuable inputs.

    Best Regards,
    DG
  2. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 30 May 2011 Link to this post

    Hi Debasis,

     
    You may take a look at the following blog post. 

    Greetings,
    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
Back to Top