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

How do I Bold the Text in ListBox Selected Item

1 Answer 120 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Debasis
Top achievements
Rank 1
Debasis asked on 30 May 2011, 07:35 AM
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

1 Answer, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 30 May 2011, 07:48 AM
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
Tags
General Discussions
Asked by
Debasis
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Share this question
or