Hello,
I am facing issue with RadListBox control styling issue when using Windows8Touch theme. Following is the description
1- I want to use different styles for each RadListBoxItem so I am using StyleSelector , It is working fine for all other themes, but as soon as I switch my application to Windows8Touch, StylesSelector stopped working. On some drilling down I came to know that in Windows8Touch "StyleSelector.SelectStyle" is not being called.
2- Following is the code for StyleSelector
3- Following is the XAML
4- Here I am setting theme in App.xaml.cs
Please help me out on this issue. I am using Q1 2013.
Regards.
I am facing issue with RadListBox control styling issue when using Windows8Touch theme. Following is the description
1- I want to use different styles for each RadListBoxItem so I am using StyleSelector , It is working fine for all other themes, but as soon as I switch my application to Windows8Touch, StylesSelector stopped working. On some drilling down I came to know that in Windows8Touch "StyleSelector.SelectStyle" is not being called.
2- Following is the code for StyleSelector
public
class
LstStyleSelector:StyleSelector
{
public
Style Red {
get
;
set
; }
public
Style Blue {
get
;
set
; }
public
override
Style SelectStyle(
object
item, DependencyObject container)
{
if
(item !=
null
)
{
if
(((KeyValuePair<
int
,
string
>)item).Key % 2 == 0)
return
Red;
else
return
Blue;
}
else
return
Red;
}
}
3- Following is the XAML
<
Grid
>
<
Grid.Resources
>
<
Style
x:Key
=
"reditem"
TargetType
=
"{x:Type telerik:RadListBoxItem}"
>
<
Setter
Property
=
"Background"
Value
=
"Red"
/>
</
Style
>
<
Style
x:Key
=
"bluitem"
TargetType
=
"{x:Type telerik:RadListBoxItem}"
>
<
Setter
Property
=
"Background"
Value
=
"Blue"
/>
</
Style
>
<
local:LstStyleSelector
x:Key
=
"itemContainerStyle"
Blue
=
"{StaticResource bluitem}"
Red
=
"{StaticResource reditem}"
/>
</
Grid.Resources
>
<
telerik:RadListBox
x:Name
=
"lstbx"
VerticalAlignment
=
"Center"
DisplayMemberPath
=
"Value"
ItemContainerStyleSelector
=
"{StaticResource itemContainerStyle}"
/>
</
Grid
>
4- Here I am setting theme in App.xaml.cs
private
void
Application_Startup(
object
sender, StartupEventArgs e)
{
//StyleManager.ApplicationTheme = new Windows8TouchTheme(); //StyleSelector not working.
StyleManager.ApplicationTheme = new Office_BlackTheme(); //StyleSelector working fine!
}
Please help me out on this issue. I am using Q1 2013.
Regards.