<Window x:Class="MainWin.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" Title="MainWindow" Height="350" Width="525"> <telerik:RadDocking x:Name="radDocking" HasDocumentHost="False" AllowUnsafeMode="True"> <telerik:RadSplitContainer InitialPosition="DockedTop" Height="50" Orientation="Vertical"> <telerik:RadPaneGroup> <telerik:RadPane PaneHeaderVisibility="Collapsed"> <Grid> <Grid.RowDefinitions> <RowDefinition></RowDefinition> <RowDefinition></RowDefinition> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition></ColumnDefinition> <ColumnDefinition></ColumnDefinition> </Grid.ColumnDefinitions> <StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" x:Name="Part1"> <telerik:RadButton Content="Office_Blue" Width="100" Height="30" Click="RadButton_Click"/> <telerik:RadButton Content="Expression_Dark" Width="100" Height="30" Click="RadButton_Click"/> </StackPanel> <StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="1" Grid.Column="0" x:Name="Part2" > <Label Content="Test1" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/> </StackPanel> <StackPanel Grid.Row="1" Grid.Column="1"> <telerik:Label Content="Label 2" HorizontalAlignment="Center" x:Name="Part3"/> </StackPanel> </Grid> </telerik:RadPane> </telerik:RadPaneGroup> </telerik:RadSplitContainer> </telerik:RadDocking> </Window>
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using Telerik.Windows.Controls; namespace MainWin { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { StyleManager.ApplicationTheme = new Expression_DarkTheme(); //StyleManager.ApplicationTheme = new Office_BlueTheme(); InitializeComponent(); } private void RadButton_Click(object sender, RoutedEventArgs e) { RadButton btn = sender as RadButton; if (btn.Content.ToString() == "Office_Blue") { SetGlobalTheme(new Office_BlueTheme()); } else { SetGlobalTheme(new Expression_DarkTheme()); } } public static void SetGlobalTheme(Theme theme) { StyleManager.ApplicationTheme = theme; foreach (Window w in Application.Current.Windows) { SetThemeToVisualObject(w); } } public static void SetThemeToVisualObject(DependencyObject myVisual) { foreach (object o in LogicalTreeHelper.GetChildren(myVisual)) { if (o is FrameworkElement) { if (o.GetType().AssemblyQualifiedName.StartsWith("Telerik.Windows.Controls")) StyleManager.SetTheme((FrameworkElement)o, StyleManager.ApplicationTheme); SetThemeToVisualObject((FrameworkElement)o); } } } } }In the MainWindow() constructor, if we use
StyleManager.ApplicationTheme = new Expression_DarkTheme();then we start the app, we will find the StackPanel is dark,
StyleManager.ApplicationTheme = new Office_BlueTheme();
the StackPanel is white.OrientedTimeRulerItemStyleSelector.HorizontalGroupItemStyle
but it doesn`t seem to work.<
scheduleView:TimeRulerItemTemplateSelector
x:Key
=
"timeRulerItemTemplateSelector"
>
<
scheduleView:TimeRulerItemTemplateSelector.HorizontalTimelineGroupTemplate
>
<
DataTemplate
>
<
StackPanel
Orientation
=
"Horizontal"
IsEnabled
=
"True"
Focusable
=
"True"
>
<
TextBlock
Text
=
"{Binding FormattedValue}"
Background
=
"Red"
/>
<
Button
Content
=
"+"
IsEnabled
=
"True"
/>
<
Button
Content
=
"-"
/>
<
TextBox
Width
=
"20"
Text
=
"123"
/>
</
StackPanel
>
</
DataTemplate
>
</
scheduleView:TimeRulerItemTemplateSelector.HorizontalTimelineGroupTemplate
>
<Style x:Key="TextBox" TargetType="{x:Type my:BaseNumericBox}">
<Setter Property="SnapsToDevicePixels"
Value="True" />
<Setter Property="OverridesDefaultStyle"
Value="True" />
<Setter Property="KeyboardNavigation.TabNavigation"
Value="none" />
<Setter Property="FocusVisualStyle"
Value="{x:Null}" />
<Setter Property="MinWidth"
Value="120" />
<Setter Property="MinHeight"
Value="20" />
 
<Setter Property="AllowDrop"
Value="true" />
 
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type my:BaseNumericBox}">
<Grid>
<Border Name="Border"
CornerRadius="2"
Padding="2"
BorderThickness="1">
<Border.Background>
<SolidColorBrush Color="{DynamicResource TextBoxControlLightColor}" />
</Border.Background>
<Border.BorderBrush>
<SolidColorBrush Color="{DynamicResource TextBoxBorderMediumColor}" />
</Border.BorderBrush>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Disabled">
<Storyboard>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"
Storyboard.TargetProperty="(Panel.Background).
(SolidColorBrush.Color)">
<EasingColorKeyFrame KeyTime="0"
Value="{DynamicResource TextBoxDisabledControlLightColor}" />
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Normal">
<Storyboard>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"
Storyboard.TargetProperty="(Panel.Background).
(SolidColorBrush.Color)">
<EasingColorKeyFrame KeyTime="0"
Value="{DynamicResource TextBoxControlLightColor}" />
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="ReadOnly">
<Storyboard>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"
Storyboard.TargetProperty="(Panel.Background).
(SolidColorBrush.Color)">
<EasingColorKeyFrame KeyTime="0"
Value="{DynamicResource TextBoxDisabledControlDarkColor}" />
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
 
<VisualState x:Name="MouseOver" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ScrollViewer Margin="0"
x:Name="PART_ContentHost" />
</Border>
</Grid>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsFocused" Value="False"></Condition>
<Condition Property="Text" Value=""></Condition>
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
</MultiTrigger.Setters>
</MultiTrigger>
<Trigger Property="IsFocused" Value="True">
<!--<Setter Property="BorderThickness" TargetName="BorderBase" Value="2.4,2.4,1,1"></Setter>-->
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="DimGray" />
<!--<Setter Property="FontStyle" Value="Italic" />-->
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
 
 
</Style>
private
void
Button_Click(
object
sender, RoutedEventArgs e)
{
int
i =
this
.radGridView.Records.IndexOf(
this
.radGridView.SelectedRecord);
int
nextCurrentIndex = i + 1;
if
(nextCurrentIndex <
this
.radGridView.Records.Count)
{
Record nextCurrentRecord =
this
.radGridView.Records[nextCurrentIndex];
nextCurrentRecord.IsSelected =
true
;
}
}