예제 #1
0
        private static void OnThemeChanged(DependencyObject target, DependencyPropertyChangedEventArgs changedEventArgs)
        {
            Theme newTheme = changedEventArgs.NewValue as Theme;

            IThemable themableControl = target as IThemable;

            if (themableControl != null)
            {
                themableControl.ResetTheme();
            }
            else
            {
                Control control = target as Control;
                if (control != null)
                {
                    Telerik.Windows.Controls.Theme.DefaultStyleKeyHelper.SetDefaultStyleKey(
                        control, ThemeResourceKey.GetDefaultStyleKey(newTheme, control.GetType()));
                }
            }
        }
예제 #2
0
 /// <summary>
 /// Raises the <see cref="E:System.Windows.FrameworkElement.Initialized"/> event.
 /// This method is invoked whenever <see cref="P:System.Windows.FrameworkElement.IsInitialized"/> is set to true internally.
 /// </summary>
 /// <param name="e">The <see cref="T:System.Windows.RoutedEventArgs"/> that contains the event data.</param>
 protected override void OnInitialized(EventArgs e)
 {
     base.OnInitialized(e);
     this.DefaultStyleKey = ThemeResourceKey.GetDefaultStyleKey(StyleManager.GetTheme(this), typeof(RadSplitButton));
 }
예제 #3
0
 private static void SetDefautStyleKeyFromTheme <T>(this T element, Theme theme)
     where T : FrameworkElement
 {
     element.SetValue(DefaultStyleKeyHelper.FindDefaultStyleKey(),
                      ThemeResourceKey.GetDefaultStyleKey(theme, typeof(T)));
 }