This question is locked. New answers and comments are not allowed.
I'm using the RadDataBoundListBox and I'm using my own theme instead of the dark and light theme. In light theme CheckmodeEnabled checkbox is there in the UI but since it is also white its not visible. Please let me know how to apply my own theme.
Thanks
Thanks
1 Answer, 1 is accepted
0
Hello Vinodh,
Thanks for contacting us and for your question.
You can apply a custom theme to the checkbox in a RadDataBoundListBoxItem by extracting the template of the item and directly setting the Style property of the checkbox.
I am pasting here the default style for RadDataBoundListBoxItem. You can add this style as a resource in your app and update it by defining a custom style for the checkbox:
Here is the style we are using for the checkbox control:
Do not hesitate to get back to us in case you have further questions or need assistance.
Kind regards,
Deyan
the Telerik team
Thanks for contacting us and for your question.
You can apply a custom theme to the checkbox in a RadDataBoundListBoxItem by extracting the template of the item and directly setting the Style property of the checkbox.
I am pasting here the default style for RadDataBoundListBoxItem. You can add this style as a resource in your app and update it by defining a custom style for the checkbox:
<
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
=
"PART_ContainerHolder"
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
=
"PART_ContainerHolder"
Storyboard.TargetProperty
=
"Foreground"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
Value
=
"{StaticResource PhoneAccentBrush}"
/>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
</
VisualStateGroup
>
</
VisualStateManager.VisualStateGroups
>
<
Grid
>
<
CheckBox
Margin
=
"24, 0, 0, 0"
Style
=
"{StaticResource ItemCheckBoxStyle}"
IsHitTestVisible
=
"False"
x:Name
=
"PART_CheckBox"
HorizontalAlignment
=
"Left"
VerticalAlignment
=
"Top"
Opacity
=
"0"
/>
<
ContentControl
x:Name
=
"PART_ContainerHolder"
HorizontalAlignment
=
"Right"
HorizontalContentAlignment
=
"{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment
=
"{TemplateBinding VerticalContentAlignment}"
Margin
=
"{TemplateBinding Padding}"
Content
=
"{TemplateBinding Content}"
ContentTemplate
=
"{TemplateBinding ContentTemplate}"
/>
</
Grid
>
</
Border
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
Here is the style we are using for the checkbox control:
<
Style
TargetType
=
"CheckBox"
x:Key
=
"ItemCheckBoxStyle"
>
<
Setter
Property
=
"Background"
Value
=
"{StaticResource PhoneRadioCheckBoxBrush}"
/>
<
Setter
Property
=
"BorderBrush"
Value
=
"{StaticResource PhoneRadioCheckBoxBrush}"
/>
<
Setter
Property
=
"FontSize"
Value
=
"{StaticResource PhoneFontSizeMedium}"
/>
<
Setter
Property
=
"FontFamily"
Value
=
"{StaticResource PhoneFontFamilyNormal}"
/>
<
Setter
Property
=
"HorizontalContentAlignment"
Value
=
"Left"
/>
<
Setter
Property
=
"VerticalContentAlignment"
Value
=
"Center"
/>
<
Setter
Property
=
"Padding"
Value
=
"0"
/>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"CheckBox"
>
<
Grid
Background
=
"Transparent"
>
<
VisualStateManager.VisualStateGroups
>
<
VisualStateGroup
x:Name
=
"CommonStates"
>
<
VisualState
x:Name
=
"Normal"
/>
<
VisualState
x:Name
=
"MouseOver"
/>
<
VisualState
x:Name
=
"Pressed"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetName
=
"CheckBackground"
Storyboard.TargetProperty
=
"Background"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
Value
=
"{StaticResource PhoneRadioCheckBoxPressedBrush}"
/>
</
ObjectAnimationUsingKeyFrames
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetName
=
"CheckBackground"
Storyboard.TargetProperty
=
"BorderBrush"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
Value
=
"{StaticResource PhoneRadioCheckBoxPressedBorderBrush}"
/>
</
ObjectAnimationUsingKeyFrames
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetName
=
"CheckMark"
Storyboard.TargetProperty
=
"Fill"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
Value
=
"{StaticResource PhoneRadioCheckBoxCheckBrush}"
/>
</
ObjectAnimationUsingKeyFrames
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetName
=
"IndeterminateMark"
Storyboard.TargetProperty
=
"Fill"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
Value
=
"{StaticResource PhoneRadioCheckBoxCheckBrush}"
/>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
<
VisualState
x:Name
=
"Disabled"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetName
=
"CheckBackground"
Storyboard.TargetProperty
=
"Background"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
Value
=
"{StaticResource PhoneRadioCheckBoxDisabledBrush}"
/>
</
ObjectAnimationUsingKeyFrames
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetName
=
"CheckBackground"
Storyboard.TargetProperty
=
"BorderBrush"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
Value
=
"{StaticResource PhoneDisabledBrush}"
/>
</
ObjectAnimationUsingKeyFrames
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetName
=
"CheckMark"
Storyboard.TargetProperty
=
"Fill"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
Value
=
"{StaticResource PhoneRadioCheckBoxCheckDisabledBrush}"
/>
</
ObjectAnimationUsingKeyFrames
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetName
=
"IndeterminateMark"
Storyboard.TargetProperty
=
"Fill"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
Value
=
"{StaticResource PhoneRadioCheckBoxCheckDisabledBrush}"
/>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
</
VisualStateGroup
>
<
VisualStateGroup
x:Name
=
"CheckStates"
>
<
VisualState
x:Name
=
"Checked"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetName
=
"CheckMark"
Storyboard.TargetProperty
=
"Visibility"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Visible</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
<
VisualState
x:Name
=
"Unchecked"
/>
<
VisualState
x:Name
=
"Indeterminate"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetName
=
"IndeterminateMark"
Storyboard.TargetProperty
=
"Visibility"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Visible</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
</
VisualStateGroup
>
</
VisualStateManager.VisualStateGroups
>
<
Grid
>
<
Border
x:Name
=
"CheckBackground"
IsHitTestVisible
=
"False"
VerticalAlignment
=
"Center"
HorizontalAlignment
=
"Left"
Background
=
"{TemplateBinding Background}"
BorderBrush
=
"{TemplateBinding Background}"
BorderThickness
=
"{StaticResource PhoneBorderThickness}"
Height
=
"32"
Width
=
"32"
/>
<
Rectangle
x:Name
=
"IndeterminateMark"
IsHitTestVisible
=
"False"
Width
=
"16"
Height
=
"16"
HorizontalAlignment
=
"Center"
VerticalAlignment
=
"Center"
Fill
=
"{StaticResource PhoneRadioCheckBoxCheckBrush}"
Visibility
=
"Collapsed"
Grid.Row
=
"0"
/>
<
Path
x:Name
=
"CheckMark"
IsHitTestVisible
=
"False"
Visibility
=
"Collapsed"
Width
=
"24"
Height
=
"18"
Stretch
=
"Fill"
HorizontalAlignment
=
"Center"
VerticalAlignment
=
"Center"
Fill
=
"{StaticResource PhoneRadioCheckBoxCheckBrush}"
Data
=
"M0,119 L31,92 L119,185 L267,0 L300,24 L122,250 z"
StrokeLineJoin
=
"Round"
StrokeThickness
=
"2"
/>
</
Grid
>
</
Grid
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
Do not hesitate to get back to us in case you have further questions or need assistance.
Kind regards,
Deyan
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!