Beispiel #1
0
        private void SetDefaultStyleKey()
        {
            Theme theme = StyleManager.GetTheme(this);

            //this.DefaultStyleKey = ThemeResourceKey.GetDefaultStyleKey(theme, typeof(RadClockItem));

            this.DefaultStyleKey = typeof(RadClockItem);
        }
Beispiel #2
0
        /// <summary>
        /// Sets the theme of the specified <see cref="DependencyObject"/>.
        /// </summary>
        /// <param name="element">The element to set the theme of.</param>
        /// <param name="parent">Parent that supplies the theme.</param>
        public static void SetThemeFromParent(DependencyObject element, DependencyObject parent)
        {
            if (element == null || parent == null)
            {
                return;
            }

            StyleManager.SetTheme(element, StyleManager.GetTheme(parent));
        }
        internal static void SetDefaultStyleKey <T>(this T itemsControl)
            where T : ItemsControl
        {
            var theme = StyleManager.GetTheme(itemsControl);

            itemsControl.ApplyThemeToItems();

            SetDefautStyleKeyFromTheme(itemsControl, theme);
        }
        private static void ApplyThemeToItems(this ItemsControl itemsControl)
        {
            Theme theme = StyleManager.GetTheme(itemsControl);

            for (int i = 0; i < itemsControl.Items.Count; i++)
            {
                var container = itemsControl.ItemContainerGenerator.ContainerFromIndex(i) as FrameworkElement;
                if (container != null)
                {
                    container.SetTheme(theme);
                }
            }
        }
        private static void OnSchedulerChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var window = (SchedulerWindow)d;

            var scheduler = e.NewValue as RadScheduler;

            if (scheduler != null)
            {
                Theme theme = StyleManager.GetTheme(scheduler);
                StyleManager.SetTheme(window.WindowWrapper.PopupWindow, theme);

                window.Language = XmlLanguage.GetLanguage(scheduler.GetCultureInUse().IetfLanguageTag);
            }
        }
        /// <summary>
        /// Called when <see cref="RadSchedulerCommands.EditRecurrenceRule"/> command gets executed.
        /// </summary>
        protected virtual void OnEditRecurrenceExecuted()
        {
            var recurrenceDialogWindow = new RecurrenceDialogWindow(this.Scheduler);

            recurrenceDialogWindow.ParentDialogWindow = this;

            StyleManager.SetTheme((recurrenceDialogWindow as DialogWindow), StyleManager.GetTheme(this.Scheduler as RadScheduler));

            (recurrenceDialogWindow as DialogWindow).IsModal = this.IsModal;
            recurrenceDialogWindow.Appointment          = this.EditedAppointment;
            recurrenceDialogWindow.RecurrenceRuleSaved += this.OnRecurrenceRuleSaved;
            recurrenceDialogWindow.Closed += OnRecurrenceDialogWindowClosed;
            recurrenceDialogWindow.Show();
        }
        public static Theme GetControlTheme(this Control control)
        {
            DependencyObject themeSource  = control;
            Theme            themeToApply = StyleManager.GetTheme(themeSource);

            while (themeSource != null && themeToApply == null)
            {
                themeSource = DependencyObjectExtensions.GetVisualParent <DependencyObject, IThemable>(themeSource);
                if (themeSource != null)
                {
                    themeToApply = StyleManager.GetTheme(themeSource);
                }
            }

            return(themeToApply);
        }
Beispiel #8
0
 /// <summary>
 /// Resets the theme.
 /// </summary>
 public void ResetTheme()
 {
     StyleManager.SetTheme(this.popupWindow, StyleManager.GetTheme(this));
     StyleManager.SetTheme(this.dialogWindow, StyleManager.GetTheme(this));
 }
Beispiel #9
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));
 }
Beispiel #10
0
 /// <summary>
 /// Resets the theme.
 /// </summary>
 public void ResetTheme()
 {
     StyleManager.SetTheme(this.window, StyleManager.GetTheme(this));
 }