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
Thank in advance for your valuable inputs.
Best Regards,
DG
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