This question is locked. New answers and comments are not allowed.
Hello,
create a new Telerik WPF application and
Create a class MyCheckBoxBox.cs, with:
Replace MainWindow.cs with:
Replace MainWindow.xaml.cs with:
Now run the application.
The second check box is not displayed in the window!
The same code (setting the theme in the control, just after the call to the inherited constructor) works well in Silverlight, but now in WPF.
Do you have a solution to make it work correctly in WPF, while having the same code for Silverlight?
Patrick
create a new Telerik WPF application and
Create a class MyCheckBoxBox.cs, with:
using
System;
using
System.Windows.Controls;
using
Telerik.Windows.Controls;
namespace
RadControlsWpfApp2
{
class
MyCheckBox : CheckBox
{
public
MyCheckBox() {
StyleManager.SetTheme(
this
, StyleManager.ApplicationTheme);
}
}
}
Replace MainWindow.cs with:
using
System;
using
System.Windows;
using
Telerik.Windows.Controls;
namespace
RadControlsWpfApp2
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public
partial
class
MainWindow : Window
{
public
MainWindow()
{
StyleManager.ApplicationTheme =
new
SummerTheme();
InitializeComponent();
StyleManager.SetTheme(CheckBox3, StyleManager.ApplicationTheme);
}
}
}
Replace MainWindow.xaml.cs with:
<
Window
x:Class
=
"RadControlsWpfApp2.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:my
=
"clr-namespace:RadControlsWpfApp2"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Grid
HorizontalAlignment
=
"Center"
Margin
=
"5"
VerticalAlignment
=
"Center"
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
CheckBox
Content
=
"With theme set in XAML"
Margin
=
"5"
telerik:StyleManager.Theme
=
"Summer"
/>
<
my:MyCheckBox
Content
=
"With theme set in code-behind (control)"
Margin
=
"5"
Grid.Row
=
"1"
/>
<
CheckBox
Name
=
"CheckBox3"
Content
=
"With theme set in code-behind (main page)"
Margin
=
"5"
Grid.Row
=
"2"
/>
</
Grid
>
</
Window
>
Now run the application.
The second check box is not displayed in the window!
The same code (setting the theme in the control, just after the call to the inherited constructor) works well in Silverlight, but now in WPF.
Do you have a solution to make it work correctly in WPF, while having the same code for Silverlight?
Patrick